Skip to content

CForChrisProooo/Windows-Auto-Timezone-Troubleshooter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Windows Location & Network Diagnostic Logger

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.


⭐ Features

  • 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 log
    • location_alerts.csv – entries where the detected city is not Brisbane (customisable)
  • Can be run as a scheduled task, without impacting a user.

🛠 Useful For Diagnosing

  • Wrong-region search results
  • Incorrect website geolocation
  • Microsoft Location Services inconsistencies
  • Wi-Fi triangulation issues
  • VPN / ISP routing / cell-tower handover anomalies

📄 Output Columns

  • 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.


⚙️ How It Works

  • 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

🧭 Use Cases

  • 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

▶️ Running the Script

Scheduled Task:

  1. Create directory "C:\Temp" on the target machine.
  2. Save the script as LocationLoggingScheduledTask.ps1 within "C:\Temp".
  3. Open task scheduler and create a new "Basic Task".
  4. Set the trigger to be whatever you like.
  5. 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:

  1. Configure to "Run only wen user is logged on".
  2. Configure to "Run with highest Privledges".
  3. 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

Interactive Script:

  1. Save the script as location.logging.ps1

  2. Run PowerShell as Administrator

  3. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors