Windows 组策略恢复默认

在 Windows 中,部分组策略通过组策略编辑器(gpedit.msc 家庭版不存在)并不能直接进行配置

而完整的组策略实际存储于注册表中

因为一些原因,例如安装系统时使用了市面上的某些 PE,而这部分 PE 会对操作系统进行一系列的更改,包括但不限于禁用 UAC、系统更新、防火墙、安全中心等等

当然还有就是误操作或者忘记自己设置了某些策略导致系统出现问题

这时我们就需要还原组策略从而达到操作系统恢复正常的目的

参考来源:https://www.elevenforum.com/t/reset-all-local-group-policy-settings-to-default-in-windows-11.21587/

通过如下命令进行组策略对应注册项的清理(以下操作不包括本地安全策略,建议在操作前进行备份):

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies" /f

reg delete "HKCU\Software\Policies" /f

reg delete "HKLM\Software\Microsoft\Policies" /f

reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /f

reg delete "HKLM\Software\Policies" /f

reg delete "HKLM\Software\WOW6432Node\Microsoft\Policies" /f

reg delete "HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies" /f

reg delete "HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /f

根据作者说明,需特别注意! 在删除 HKLM\Software\Microsoft\Windows\CurrentVersion\Policies 时会导致 Windows 设置 -> 应用程序 -> 启动 页面丢失,所以我在命令中移除了对这个项的删除

如果你仍然需要移除该项,请按照如下命令依次执行,必需全部执行

reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies" /f

:: 如下是对必要的键值恢复默认
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v SupportUwpStartupTasks /t REG_DWORD /d 1 /f

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableFullTrustStartupTasks /t REG_DWORD /d 2 /f

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableUwpStartupTasks /t REG_DWORD /d 2 /f

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v SupportFullTrustStartupTasks /t REG_DWORD /d 1 /f

最后移除相应的文件并执行更新组策略命令:

rd /s /q "%windir%\System32\GroupPolicy"
rd /s /q "%windir%\System32\GroupPolicyUsers"

mkdir "%windir%\System32\GroupPolicyUsers"

gpupdate /force

关于 gpupdate,可参考官方:https://learn.microsoft.com/zh-cn/windows-server/administration/windows-commands/gpupdate

建议在恢复默认后重启系统

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

至天

看心情啦,最好留着自己喝奶茶

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值