Windows Server: NTP configuration

After having installed a new domain, I had to configure both time and timezone on the new AD servers, without using the time provided by the hypervisor, I had to configure those Windows servers to use an external NTP server. As I prefer to do that using script, I read the documentation to find out the proper commands to use:

# Configure Time Zone and NTP server
$TimeZoneID = "UTC"
$NTPServer = "ca.pool.ntp.org"

# Update the timezone
Set-TimeZone -Id $TimeZoneID -PassThru

# Set the NTP server
w32tm /config /syncfromflags:manual /manualpeerlist:"$NTPServer" /reliable:yes /update

# Restart the time service
Restart-Service w32time

If you want to see what’s configured, here some useful commands. Note that it could take between 10 and 60 seconds for the source and time to be updated depending on your network:

To show details about the current configuration:

w32tm /query /status

To see only information about the time source:

w32tm /query /source

One comment

Leave a Reply