# Set the time server $TimeServer = "gbg1.ntp.se" # Configure the time server Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" ` -Name "NtpServer" -Value $TimeServer Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config" ` -Name "AnnounceFlags" -Value 5 Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" ` -Name "SpecialPollInterval" -Value 900 Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config" ` -Name "MaxPosPhaseCorrection" -Value 3600 Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config" ` -Name "MaxNegPhaseCorrection" -Value 3600 # Restart the Windows Time service Restart-Service w32time