用Powershell強制同步Windows主機與Internet time server的時間

第一步,判斷Windows Time服務是否正在運行,若是沒有,則開啓它。shell

第二步,強制同步,不知爲什麼,每每第一次會失敗,那麼就多運行幾回好了。blog


Get-Service w32time | Where {$_.status –eq 'Stopped'} |  Start-Service
W32tm /resync /force
W32tm /resync /force


參考資料ip

==========get

https://devblogs.microsoft.com/scripting/powertip-force-time-resync-with-powershell/同步

https://redmondmag.com/articles/2016/01/22/powershell-to-manage-system-services.aspxit

相關文章
相關標籤/搜索