Wednesday, June 30, 2021

Fix Computer Clock Drifts with W32tm

Under normal circumstances computer clocks do not drift on domain joined machines. Windows will trigger the "Windows Time Service", W32Time, service at random intervals and it will sync the time with the machine that holds the PDC emulator operations master role. But if a machine is not joined to the domain or was previously configured with some other source then the clock might start to drift occasionally. 

There are number of ways to resolve the issue. 

With a batch script and Task Scheduler

Step 1
Open Notepad and type the below command. 
w32tm /config /manualpeerlist:"time.google.com" /syncfromflags:manual /update

The script sets the time server to time.google.com and then syncs the time with it. 

Step 2
Save the Notepad file as batch file (.bat file)

Step 3
Run Task Schedule and create a basic tasks and schedule it to run daily. Under action add the batch file and save it. On the Task Schedule, under the General tab make sure you check the box "Run with highest privileges". 

If you want to know more about Windows Time Service and the command-line tool W32tm.exe to configure Windows Time Service, visit the website at https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings 


No comments:

Post a Comment

Please leave your comments and suggestions.

Simplify Third-Party Application Patching with Chocolatey

Managing third-party application updates can be a time-consuming task, especially in an IT environment where automation is crucial. In this ...