close

使用 powershell 更改 NTP 

Script 如下

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018

# Configure Time Zone and NTP server

# Variables
$TimeZone = "Taipei Standard Time"
$NTPServer = "tick.stdtime.gov.tw"

# 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

 

以上修改為台灣地區及中華電信NTP

參考來源 : 

Configuring NTP client using PowerShell

PowerShell: Administering Network Time Protocol Settings on Windows

Check NTP in PowerShell ?

timeanddate


arrow
arrow
    文章標籤
    NTP powershell script
    全站熱搜

    sungshu 發表在 痞客邦 留言(0) 人氣()