A PowerShell script that logs location sources, geographic coordinates, timezone, public IP, and nearby Wi-Fi network details (SSIDs & BSSIDs) to CSV files.
Designed to help diagnose incorrect geolocation, Wi-Fi positioning errors, and unexpected region mismatches on Windows systems.
- Logs latitude, longitude, accuracy, city, state, country
- Detects whether the location is derived from Wi-Fi or IP-based sources
- Records your current public IP address
- Scans and logs all nearby Wi-Fi SSIDs and BSSIDs
- SSIDs and BSSIDs are strictly separated
- Multiple networks stored in a single row
- Logs your current system timezone
- Generates two CSV files:
location_log.csv– full continuous loglocation_alerts.csv– entries where the detected city is not Brisbane (customisable)
- Can be run as a scheduled task, without impacting a user.
- Wrong-region search results
- Incorrect website geolocation
- Microsoft Location Services inconsistencies
- Wi-Fi triangulation issues
- VPN / ISP routing / cell-tower handover anomalies
- Timestamp
- Latitude
- Longitude
- Accuracy
- City
- State
- Country
- Source (WiFi or IP/Other)
- PublicIP
- SSIDs
- BSSIDs
Each scan produces one row.
SSIDs and BSSIDs are semicolon-separated lists.
- Uses GeoCoordinateWatcher to acquire coordinates
- Scans nearby access points via:
netsh wlan show networks mode=bssid
- Performs reverse geocoding using OpenStreetMap (Nominatim)
- Reads your system-reported timezone
- Appends data to CSV files every 15 seconds
- Troubleshooting incorrect GeoIP or Wi-Fi location on Windows
- Understanding why Microsoft services think you're in the wrong city
- Auditing network coverage, duplicate SSIDs, or rogue APs
- Recording movement patterns for testing or automation
- Tracking public IP changes over time
- Create directory "C:\Temp" on the target machine.
- Save the script as
LocationLoggingScheduledTask.ps1within "C:\Temp". - Open task scheduler and create a new "Basic Task".
- Set the trigger to be whatever you like.
- Set the action to run a program:
Program/Script: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" Add Arguments: "-WindowStyle Minimized -NoProfile -ExecutionPolicy Bypass -File "C:\Temp\LocationLoggingScheduledTask.ps1"" Start In: "C:\Temp"
General Page:
- Configure to "Run only wen user is logged on".
- Configure to "Run with highest Privledges".
- Configure to use the user account of a user interactively logged into the machine (you should not need the user acc password).
Everything else can be left as default.
Notes: The script can be run by right-clicking the task and choosing "Run". The script will only run for 6 hours before exiting. The logs are output to "C:\Temp" instead of user appdata. The script must run interactively in the user session, hence it starts minimized, and the user could close it unintentionally. Expected running result is 0x41301
-
Save the script as
location.logging.ps1 -
Run PowerShell as Administrator
-
Execute:
Set-ExecutionPolicy Bypass -Scope Process -Force .\location.logging.ps1
File will output to user folder (if running as admin this will be the admin user) USERPROFILE\location_log.csv USERPROFILE\location_alerts.csv
🏙 Changing the Expected City (Alert Trigger)
This script alerts when the detected city does not match your expected location. By default, it is set to Brisbane.
To change it:
Open the script in a text editor
Find the line:
$ExpectedCity = "Brisbane"
Replace "Brisbane" with your preferred city, e.g.:
$ExpectedCity = "Sydney"
📌 Notes
Uses the OpenStreetMap Nominatim API — please respect rate limits
Works on Windows 10 and Windows 11
Wi-Fi scanning requires an enabled wireless adapter
SSID/BSSID parsing is strict to avoid mixed or malformed data
📜 License
MIT License.