A time service that is already present in Windows operating systems monitors the system time. As a result of a time drift or because the system time is inaccurate, it may occasionally be necessary to manually change the system time. In this post, we’ll examine utilizing the Command Prompt to control the system time in Windows.
Setting the Time
Here are the steps to set the time via the Command Prompt:
1. Stop the time service:
net stop w32time
2. Unregister the time service:
w32tm /unregister
3. Register the time service:
w32tm /register
4. Set the manual peer list for external time servers:
w32tm /config /syncfromflags:manual /manualpeerlist:0.us.pool.ntp.org,1.us.pool.ntp.org /reliable:yes /update
5. Set the connection as reliable:
w32tm /config /reliable:yes
6. Start the time service:
net start w32time
7. Resync the time:
w32tm /resync /nowait
8. Resync the time and rediscover:
w32tm /resync /rediscover
9. Test the time:
w32tm /query /status
10. Show the source of the time:
w32tm /query /source
11. Show the time service configuration:
w32tm /query /configuration
Display Time in Windows
Here are the different ways to display the time in Windows using the Command Prompt:
1. Display time of the local computer:
NET TIME \\%ComputerName%
2. Display time on another computer:
NET TIME \\ComputerName
3. Display time of the logon server:
NET TIME %LogonServer%
4. Display time of the domain time server:
NET TIME /Domain
5. Sync time with the domain time:
NET TIME /DOMAIN /SET /Y
Location of the Time Server Type in the Registry
The type of the time server (NTP or NT5DS) is stored in the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
We have explored how to manage the system time in Windows using the Command Prompt. By using the commands discussed in this article, you can easily set, display, and sync the system time. However, it’s important to note that these commands should be used with caution, as incorrect time settings can cause issues with other applications and services that rely on accurate time.