如何将 Windows 更新设置为从不使用 PowerShell 检查更新? [英] How do I set Windows Update to never check for updates with PowerShell?
本文介绍了如何将 Windows 更新设置为从不使用 PowerShell 检查更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找使用 PowerShell、Windows Server 2008 R2 编写脚本的帮助,因此 Windows 更新设置为从不检查更新".我找到了一些接近的答案,但我仍然不能做我想做的.目前,我必须通过单击 Windows 更新 > 更改设置 > 从不检查更新来设置它.提前致谢.
I'm looking for help scripting with PowerShell, Windows Server 2008 R2 so Windows Updates is set to "Never check for updates." I found some near answers but I still can't do what I want. Currently, I have to set it by clicking Windows Update > Change Settings > Never Check for Updates. Thanks in advance.
推荐答案
您可以为此使用 COM 对象:
You can use a COM object for that :
$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 会话.
You must use a PowerShell session run as administrator in an elevated mode.
这篇关于如何将 Windows 更新设置为从不使用 PowerShell 检查更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文