我正在寻找与Windows PowerShell,Windows Server 2008 R2脚本的帮助,所以Windows Updates被设置为“从不检查更新”。 我发现了一些接近的答案,但我仍然不能做我想要的。 目前,我必须通过单击Windows Update>更改设置>从不检查更新来设置它。 提前致谢。
你可以使用一个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
带有:
NotificationLevel : 0 = Not configured; 1 = Disabled; 2 = Notify before download; 3 = Notify before installation; 4 = Scheduled installation;
你可以测试:
$WUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings $WUSettings.NotificationLevel=1 $WUSettings.save()
(编辑)的
您必须使用以升级模式以管理员身份运行的PowerShell会话。