【Powershell】同步整个域时间跟北京时间一致

最近发现整个域的时间比北京晚了近5分钟,部分域外的应用程序在进行身份验证的时候开始报错:

According to Microsoft, The internal clock for servers must be set to within 10 minutes of the domain controller‘s clock. If the clocks are not synchronized then Kerberos authentication will fail。

考虑到域内的所有服务器时间都是跟PDC同步的,只需要设定PDC跟北京时间同步,即可让整个域同步;操作步骤如下:

(1)将time.windows.com作为PDC的权威时间来源;

w32tm /config /update /manualpeerlist:time.windows.com /syncfromflags:manual /reliable:yes

(2)从DNS中导出域中所有的服务器列表,保存为CSV格式文件;

 

整理文件格式如下:

 

(3)手动执行powershell语句,将域内服务器时间与PDC一致;(等待完成即可)

$names=Get-Content d:\dn.csv
foreach ($name in $names) {w32tm /resync /computer:$name}

本文出自 “缘随心愿” 博客,请务必保留此出处http://281816327.blog.51cto.com/907015/1566870

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。