如何将Windows Update设置为从不使用PowerShell检查更新?

use*_*194 8 windows powershell

我正在寻找PowerShell,Windows Server 2008 R2的帮助脚本,因此Windows更新设置为"从不检查更新".我找到了一些接近的答案,但我仍然不能做我想要的.目前,我必须通过单击Windows Update>更改设置>从不检查更新来设置它.提前致谢.

JPB*_*anc 11

您可以使用COM对象:

$WUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
$WUSettings
NotificationLevel         : 2
ReadOnly                  : True
Required                  : False
ScheduledInstallationDay  : 0
ScheduledInstallationTime : 3
IncludeRecommendedUpdates : True
NonAdministratorsElevated : True
FeaturedUpdatesEnabled    : True
Run Code Online (Sandbox Code Playgroud)

用:

NotificationLevel  :
0 = Not configured;
1 = Disabled;
2 = Notify before download;
3 = Notify before installation;
4 = Scheduled installation;
Run Code Online (Sandbox Code Playgroud)

你可以测试:

$WUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
$WUSettings.NotificationLevel=1
$WUSettings.save()
Run Code Online (Sandbox Code Playgroud)

(编辑)的

您必须在提升模式下以管理员身份运行PowerShell会话.