Skip to content

Instantly share code, notes, and snippets.

@lantrix
Created February 10, 2016 01:48
Show Gist options
  • Select an option

  • Save lantrix/3816a6256fa2b5f252b0 to your computer and use it in GitHub Desktop.

Select an option

Save lantrix/3816a6256fa2b5f252b0 to your computer and use it in GitHub Desktop.
Powershell Set + Test NTP on Windows Server
#Enabled w32tm debug
w32tm /debug /enable /file:C:\w32tmdebug.log /size:10485760 /entries:0-300
#Configure NTP
Push-Location
Set-Location HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers
Set-ItemProperty . 1 "server1.domain.local"
Set-ItemProperty . 2 "server2.domain.local"
Set-ItemProperty . "(Default)" "1"
Set-Location HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Parameters
#0x8 - client ; 0xA - client + use as fallback
Set-ItemProperty . NtpServer "server1.domain.local,0x8 server2.domain.local,0xA"
Pop-Location
Get-Service -Name W32Time | Restart-Service
#Show status
w32tm /query /source
w32tm /query /status /verbose
w32tm /monitor /computers:server1.domain.local
w32tm /stripchart /computer:server1.domain.local
#View Debug log at C:\w32tmdebug.log
#Diabled debug
w32tm /debug /disable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment