我正在寻找Power
Shell,Windows Server 2008 R2的帮助脚本,因此Windows更新设置为“从不检查更新”.我找到了一些接近的答案,但我仍然不能做我想要的.目前,我必须通过单击Windows Update>来设置它.更改设置>从不检查更新.提前致谢.
您可以使用COM对象:
原文链接:https://www.f2er.com/windows/365293.html$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会话.