Sunday, September 24, 2023

Sync Windows system time with time.windows.com on startup (all Windows versions)

Here are the steps to sync Windows system time with time.windows.com on startup. I've confirmed that this solutions works on Windows 7 and 10, it should also work on all currently available versions of the Windows operating system:

1. Open PowerShell by typing PowerShell into the search bar in your Windows start bar. 

2. Copy and paste the below line of code into PowerShell:

%windir%\system32\sc.exe start w32time task_started

3. Save As... the file to your Windows Startup folder for all users as "timeSync.bat" or whatever name will help you remember what this file is. It needs to be saved as a .bat file or it will not work.

Where your startup folder is located will depend on your version and installation of Windows, but you can try: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

Please note that some versions of Windows has a startup folder for individual users as well as for all system users. Individual startup folders are located somewhere within the user's folder.

4. After you add the file to your startup folder, I would hit Windows Key + R and run msConfig. From there make sure that the bat file is set to run.

5. Restart your system.

It may take 30 to 60 seconds for this bat file to run after a user logs on. If you have a way to get the script to execute faster please comment below. 

6. If the system time does not automatically update after startup hit Windows Key + R and run services.msc

Make sure that the local service Windows Time is set to Automatic startup type. To modify this, right click on Windows Time and select Properties. Reset your system again.

Use cases for this issue:

I setup a dual boot between Ubuntu and Windows. Whenever I boot up Ubuntu, the system time gets converted to UTC which throws off the system time for Windows. Since websites' security certificates rely on system time to verify certificates I could not access most websites and the system time threw off how the f.lux application worked.