Post

Set Windows 2012 R2 NTP Settings Using PowerShell

Set Windows 2012 R2 NTP Settings Using PowerShell

Configuring NTP and Time Settings in Windows Server 2012 R2

This guide demonstrates how to configure Network Time Protocol (NTP) settings and time zones on Windows Server 2012 R2 using PowerShell and command-line tools.

Configuring NTP Server Settings

Step 1: Set the NTP Server

Use the Windows Time (w32tm) command to configure the NTP server:

1
2
# Configure Windows Time service to use pool.ntp.org as the time source
w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:MANUAL

The command should return a success message.

Step 2: Restart the Windows Time Service

Restart the Windows Time service to apply the changes:

1
2
3
4
5
# Stop the Windows Time service
Stop-Service w32time

# Start the Windows Time service
Start-Service w32time

Configuring Time Zone Settings

Step 1: List Available Time Zones

To view all available time zones:

1
2
# List all available time zones
tzutil /l

Example output (truncated):

1
2
3
4
5
6
7
8
9
10
11
12
13
(UTC-12:00) International Date Line West
Dateline Standard Time

(UTC-11:00) Coordinated Universal Time-11
UTC-11

...

(UTC+09:00) Osaka, Sapporo, Tokyo
Tokyo Standard Time

(UTC+09:00) Seoul
Korea Standard Time

Step 2: Set the Time Zone

Once you’ve identified the desired time zone, set it using the tzutil command:

1
2
# Set the time zone to Tokyo Standard Time
tzutil /s "Tokyo Standard Time"

Additional Time Configuration Commands

Verify Current Time Settings

1
2
3
4
5
6
7
8
# Check the current time configuration
w32tm /query /status

# Check the current time source
w32tm /query /source

# Check detailed configuration
w32tm /query /configuration

Force Time Synchronization

1
2
# Force immediate synchronization with the time server
w32tm /resync /force

Configure NTP Server for Domain Controllers

For domain controllers, you may want to configure them as reliable time sources:

1
2
3
4
5
# Configure a domain controller as an NTP server
w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:MANUAL /reliable:YES

# Restart the service to apply changes
Restart-Service w32time

Troubleshooting

If you encounter issues with time synchronization:

  1. Check Windows Time service status:
    1
    
    Get-Service w32time
    
  2. Verify firewall settings allow NTP traffic (UDP port 123)

  3. Check the Windows Time event log:
    1
    
    Get-EventLog -LogName System -Source "Time-Service"
    
This post is licensed under CC BY 4.0 by the author.