Windows恢复组策略默认配置(清空组策略配置)

2024-02-01 07:51:19 浏览数 (1)

Windows如何恢复组策略默认配置(清空组策略配置)?

cmd执行如下4句命令

代码语言:javascript复制
secedit /configure /cfg c:windowsinfdefltbase.inf /db defltbase.sdb /verbose
rd /s /q "c:windowsSystem32GroupPolicyUsers"
rd /s /q "c:windowsSystem32GroupPolicy"
gpupdate /force

上述第一句命令是用secedit恢复系统初安装时的默认安全设置

腾讯云公共镜像组策略配置了windows时间服务

想通过命令配置ntp server都不生效,因为有组策略已配项的情况下,组策略优先级最高,命令配的不起作用

要想命令配置ntp server,前提是先清空组策略,然后再用命令配,例如

cmd或powershell

代码语言:javascript复制
w32tm /query /source
w32tm /query /configuration
secedit /configure /cfg c:windowsinfdefltbase.inf /db defltbase.sdb /verbose
#cmd: rd /s /q "c:windowsSystem32GroupPolicyUsers"
#cmd: rd /s /q "c:windowsSystem32GroupPolicy"
cmd.exe /c rd /s /q "c:windowsSystem32GroupPolicyUsers"
cmd.exe /c rd /s /q "c:windowsSystem32GroupPolicy"
gpupdate /force
net stop w32time
net start w32time
w32tm /config /manualpeerlist:"time.windows.com,0x8 ntpupdate.tencentyun.com,0xa time1.tencentyun.com,0xa" /syncfromflags:manual /reliable:yes /update
w32tm /query /configuration

w32tm /query /source
w32tm /query /peers
w32tm /resync /rediscover /nowait
w32tm /resync /rediscover /nowait
w32tm /resync /rediscover /nowait

上面命令里的0x8和0xa解释:

第一个主用0x8,剩下的备用0xa,备可以加多个,都是0xa,例如

代码语言:javascript复制
w32tm /config /manualpeerlist:"time1.tencentyun.com,0x8 time2.tencentyun.com,0xa time3.tencentyun.com,0xa time4.tencentyun.com,0xa time5.tencentyun.com,0xa" /syncfromflags:manual /reliable:yes /update

0 人点赞