Skip to content

Instantly share code, notes, and snippets.

@rm77
Created July 1, 2020 01:27
Show Gist options
  • Save rm77/e0f2446b9ec8807f913c064a8af763d9 to your computer and use it in GitHub Desktop.
Save rm77/e0f2446b9ec8807f913c064a8af763d9 to your computer and use it in GitHub Desktop.
set time zone and ntp server
# Configure Time Zone and NTP server
# Variables
$TimeZone = "SE Asia Standard Time"
$NTPServer = "ntp.its.ac.id"
# Configure NTP and restart service
Set-TimeZone -Id $TimeZone -PassThru
Push-Location
Set-Location HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers
Set-ItemProperty . 0 $NTPServer
Set-ItemProperty . "(Default)" "0"
Set-Location HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Parameters
Set-ItemProperty . NtpServer $NTPServer
Pop-Location
Stop-Service w32time
Start-Service w32time
#jalankan dengan powershell -File set_time.ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment