PowerShell: force a Windows time sync
The script
Run w32tm /resync /force from an elevated prompt, then w32tm /query /status to confirm the source and offset. If the resync errors with "the service has not been started", start w32time first. Clock skew beyond five minutes breaks Kerberos sign-ins, which is usually why you are here.
Start-Service w32time -ErrorAction SilentlyContinue
w32tm /resync /force
w32tm /query /status
Notes before you run it
- Domain-joined machines should show a domain controller as the source. A workgroup machine syncing from
Local CMOS Clockis not syncing at all; point it somewhere withw32tm /config /syncfromflags:manual /manualpeerlist:"pool.ntp.org" /update. - Skew that returns after every reboot on older hardware is a dying CMOS battery, not a Windows problem.
- Virtual machines should usually sync from the domain hierarchy, not the hypervisor and the domain at once; pick one.
Run it on every machine, not one at a time.
Save any of these as a command in Moorfox and run it on a machine in one click, output and exit code captured, with no PSRemoting or WinRM setup. The agent runs it locally and reports back, even over the internet.