Skip to content

Instantly share code, notes, and snippets.

@rob89m
Last active December 23, 2019 01:12
Show Gist options
  • Save rob89m/81acc83d66a56de3ed6fd6c8e43410fc to your computer and use it in GitHub Desktop.
Save rob89m/81acc83d66a56de3ed6fd6c8e43410fc to your computer and use it in GitHub Desktop.
Set Time Sync #NTP #TIME
<#
.DESCRIPTION
This script set external NTP to NTP.ORG then resync the time.
#>
# Set W32Time to Automatic start if not already enabled
Get-Service w32time | `
%{If($_.StartType -ne "Automatic"){Set-Service w32time -StartType Automatic}} | `
# Set the external NTP Server
w32tm.exe /config /manualpeerlist:"au.pool.ntp.org" /syncfromflags:manual /reliable:yes /update
# Restart the w32tm service
net stop w32time
net start w32time
# Resync the time the the external NTP Server
w32tm /resync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment