This command will cause the system clock to sync with Internet time servers. It is useful when an older server is losing time.
$Time = w32tm /stripchart /computer:time.windows.com /samples:1 /dataonly Write-host ($Time[2]) -ForegroundColor Green Write-host "The PC time is "(get-date) -ForegroundColor Yellow Write-host "NTP Status:" -ForegroundColor Yellow Write-host (w32tm /query /status) -ForegroundColor Yellow Write-host (w32tm /query /source) -ForegroundColor Yellow Write-host "------------------"-ForegroundColor Yellow Write-host "Setting NTP Source"-ForegroundColorGreen net stop w32time w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org",0x8 /syncfromflags:MANUAL w32tm /config /reliable:yes net start w32time start-sleep 10 Write-host "------------------"-ForegroundColor Green Write-host (w32tm /query /source) -ForegroundColor Green Write-host (w32tm /query /status) -ForegroundColor Green $Time = w32tm /stripchart /computer:time.windows.com /samples:1 /dataonly Write-host ($Time[2]) -ForegroundColor Green Write-host "The PC time is Now:"(get-date) -ForegroundColor Green
On a PDC run:
net stop w32time w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org",0x8 /syncfromflags:MANUAL w32tm /config /reliable:yes net start w32time
Check the status with:
w32tm /query /status w32tm /query /peers
On other servers run:
net stop w32time w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org",0x8 /syncfromflags:MANUAL net start w32time