我正在寻找使用 PowerShell、Windows Server 2008 R2 编写脚本的帮助,因此 Windows 更新设置为“从不检查更新”。我找到了一些接近的答案,但我仍然无法做我想做的事。目前,我必须通过单击“Windows 更新”>“更改设置”>“从不检查更新”来设置它。提前致谢。
您可以为此使用 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
With :
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()
(Edited)
您必须使用以管理员身份在提升模式下运行的 PowerShell 会话。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)