Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Monthly Archives: April 2020

HOWTO: Configure Time (NTP) for Windows Server 2016 Using Command Line (cmd)

This is aimed to be complete steps for configuring the time service (NTP) for Windows Sever 2016. This is especially useful should you want to setup your own Active Directory Domain Controller (ADDC).

0. Networking Check

Ensure you can reach the NTP server. Assuming you are using 0.pool.ntp.org :

ping 0.pool.ntp.org

1. Set the Time Zone

By default, windows just assume a time zone and show you the system clock. However, the default time zone is not necessary correct.

1.1. Check the Current Timezone

tzutil /g

1.2 (Optional) Query Available Time Zone

tzutil /l

1.3 (Optional) Set Time Zone

tzutil /s "E. Australia Standard Time"

2. Set the w32time service

2.1 Configure NTP Service

w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org" /syncfromflags:manual /reliable:no /update

2.2 Confirm that NTP Configuration

List the peers

w32tm /query /peers
The result looks like:
#Peers 3
Peer: 1.pool.ntp.org
State: Active
Time Remaining: 123.4567890s
Mode: 1 (Symmetric Active)
...

List the time source

w32tm /query /source
The result looks like:
1.pool.ntp.org

2.3 Resync

w32tm /resync
The result looks like:
Sending resync command to local computer
The command completed successfully.

2.4 Indicate that NTP service is now reliable

w32tm /config /reliable:yes /update

2.5 Confirm status

w32tm /query /status
The result should looks like:
Leap Indicator: 0(no warning)
...

This should be it.