Saturday, September 29, 2018

NTP Server on Windows 2008/2012/2016


Having right time on all clients, server and network devices is very critical. It helps a lot in troubleshooting issues and saves from many issues like.

  • User unable to login to domain.
  • Network devices logs showing wrong date and time make it
          difficult to correlate.
  • Synchronization errors in various application.
  • Legal and regulatory issues.

At the same time, we can’t allow all computers/devices to sync time from internet. So Local NTP server in DC makes a lot of sense. Some people install a Linux server for this purpose but that requires you to maintain a server just for this purpose.
Following commands has been tested to work on Windows Server 2008/R2/2012 R2 and 2016. However, it should work on Windows XP/2003/R2/7/10 as well. As required services are anyway available.
Windows Server can act as time server but needs manual configuration. And can be accomplished using a few commands from PowerShell.

Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config -Name AnnounceFlags -Value 5


Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters -Name Type -Value ‘NTP’



Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer -Name Enabled -Value 1



Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters -Name NtpServer -Value ‘time.windows.com,0x1’



Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient -Name SpecialPollInterval -Value 1800



Set-ItemProperty –Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config -Name MaxPosPhaseCorrection -Value 86400


Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config -Name MaxnegPhaseCorrection -Value 86400

Stop-Service -Name W32Time
Start-Service -Name W32Time
Set-Service –Name W32Time -StartupType Automatic

Troubleshooting Commands
W32tm /query /status



W32tm /query /configuration



Configure Client to sync time from NTP Server


Testing Client Status



 




No comments: