Windows systems maintain time synchronization through the Windows Time service (W32Time). By default, domain-joined machines sync with domain controllers, while standalone computers typically use time.windows.com as their NTP server.
The primary command for forcing time synchronization is:
w32tm /resync
This command tells the Windows Time service to immediately resynchronize with its configured time source.
Before forcing synchronization, check your current time configuration:
w32tm /query /status
This displays detailed information including:
- Current NTP server
- Last successful sync time
- Time source type
- Clock precision and stability
For more control over the synchronization process:
# Force synchronization with verbose output w32tm /resync /rediscover /nowait # Update time zone information tzutil /s "Pacific Standard Time"
If synchronization fails, try these diagnostic commands:
# Check time service status sc query w32time # Test NTP server connectivity w32tm /stripchart /computer:time.windows.com /dataonly /samples:3 # Re-register time service w32tm /unregister w32tm /register net start w32time
For batch processing or automated maintenance scripts:
@echo off w32tm /resync > NUL if %errorlevel% neq 0 ( echo Time synchronization failed w32tm /config /update net stop w32time net start w32time w32tm /resync )
To change the default NTP server (admin rights required):
w32tm /config /syncfromflags:manual /manualpeerlist:"pool.ntp.org,time.nist.gov" /update net stop w32time && net start w32time
For domain controllers, additional considerations apply:
# For PDC emulator in a domain w32tm /config /syncfromflags:domhier /reliable:yes /update net stop w32time net start w32time
To manually synchronize time on Windows systems, use this command in an elevated Command Prompt:
w32tm /resync
This forces immediate synchronization with the configured time source. For servers in domain environments, this typically means syncing with the domain hierarchy. For workstations in workgroups, it uses the configured NTP server.
Before forcing synchronization, check your current time configuration:
w32tm /query /status
This displays valuable information including:
- Current time source
- Last successful sync time
- Time service status
- Clock precision
For more control over time synchronization, these commands are valuable:
REM Update time settings without restarting the service w32tm /config /update REM Manually specify a time server (for workgroup computers) w32tm /config /manualpeerlist:"time.windows.com,0x1" /syncfromflags:manual /reliable:yes /update REM Check time offset from current source w32tm /stripchart /computer:time.windows.com /dataonly /samples:3
If synchronization fails, try these diagnostic steps:
REM Restart the Windows Time service net stop w32time && net start w32time REM Re-register the time service w32tm /unregister w32tm /register REM Check firewall settings for UDP port 123 netsh advfirewall firewall show rule name="NTP"
For regular maintenance, create a PowerShell script:
try { $result = w32tm /resync 2>&1 if ($LASTEXITCODE -ne 0) { throw "Time sync failed: $result" } Write-Output "Time synchronized successfully" } catch { Write-Error $_.Exception.Message # Additional error handling logic here }
- Domain controllers should sync with reliable external sources
- Use Group Policy to configure time settings across the domain
- Monitor time sync status via event logs (Event ID 37)
- Consider using GPS-based time sources for critical infrastructure