使用 powershell 禁用自动更新 (2012R2)

Disable automatic updates (2012R2) with powershell

我看到了一些相关问题,但 none 的解决方案对我不起作用。 我有 windows 服务器 2012R2,我需要使用 Powershell v5.0 或批处理(首选 Powershell)禁用它自动 windows 更新。

我可以手动完成,打开 gpedit.msc ,导航到 Computer Configuration -> Administrative Templates -> Windows Components -> Windows Update 然后将 Configure Automatic Updates 更改为 Disable.

如何在不使用外部 powershell 模块(例如 PolicyFileEditor)的情况下自动完成

是否有等效的注册表项可以更改它来完成工作?我知道 Windows 服务器 2008 有一个,但我使用的是 2012R2。

这是Windows更新的注册键full list,仅供参考,但如果将HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAutoUpdate设置为1,则会禁用Windows更新。

您可以使用 New-ItemProperty 使用 PowerShell 设置此值