首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >阻止特定的Windows更新修补程序

问阻止特定的Windows更新修补程序
EN

Server Fault用户
提问于 2010-05-27 13:05:55
回答 4查看 24.3K关注 0票数 9

我想保持Windows自动更新启用,但阻止一个特定的补丁被安装,这是造成我们的问题。

这个是可能的吗?有人知道怎么做吗?

EN

回答 4

Server Fault用户

发布于 2011-12-15 18:25:13

在更大的网络中,正如DanBig所指出的那样,您将希望使用WSUS。但是,如果您想阻止单个热修复,可以使用以下脚本使用热修复ID来阻止:

代码语言:javascript
复制
If Wscript.Arguments.Count = 0 Then
    WScript.Echo "Syntax: HideWindowsUpdate.vbs [Hotfix Article ID]" & vbCRLF & _
                 "Examples:" & vbCRLF & _
                 "  - Hide KB940157: HideWindowsUpdate.vbs 940157"
    WScript.Quit 1
End If

Dim hotfixId
hotfixId = WScript.Arguments(0)

Dim updateSession, updateSearcher
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateUpdateSearcher()

Wscript.Stdout.Write "Searching for pending updates..." 
Dim searchResult
Set searchResult = updateSearcher.Search("IsInstalled=0")

Dim update, kbArticleId, index, index2
WScript.Echo CStr(searchResult.Updates.Count) & " found."
For index = 0 To searchResult.Updates.Count - 1
    Set update = searchResult.Updates.Item(index)
    For index2 = 0 To update.KBArticleIDs.Count - 1
        kbArticleId = update.KBArticleIDs(index2)
        If kbArticleId = hotfixId Then
            WScript.Echo "Hiding update: " & update.Title
            update.IsHidden = True
        End If        
    Next
Next

如果更新未链接到KB文章,则需要使用以下脚本查找更新ID:

代码语言:javascript
复制
Dim updateSession, updateSearcher
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateUpdateSearcher()

Wscript.Stdout.Write "Searching for pending updates..." 
Dim searchResult
Set searchResult = updateSearcher.Search("IsInstalled=0")

Dim update, kbArticleId, index, index2
WScript.Echo CStr(searchResult.Updates.Count) & " found."
For index = 0 To searchResult.Updates.Count - 1
    Set update = searchResult.Updates.Item(index)
    WScript.Echo update.Identity.UpdateID & ": " & update.Title
Next

并使用以下脚本阻止它:

代码语言:javascript
复制
If Wscript.Arguments.Count = 0 Then
    WScript.Echo "Syntax: HideWindowsUpdateById.vbs [Update ID]" & vbCRLF & _
                 "Examples:" & vbCRLF & _
                 "  - Hide KB940157: HideWindowsUpdateById.vbs 2ba85467-deaf-44a1-a035-697742efab0f"
    WScript.Quit 1
End If

Dim updateId
updateId = WScript.Arguments(0)

Dim updateSession, updateSearcher
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateUpdateSearcher()

Wscript.Stdout.Write "Searching for pending updates..." 
Dim searchResult
Set searchResult = updateSearcher.Search("UpdateID = '" & updateId & "'")

Dim update, index
WScript.Echo CStr(searchResult.Updates.Count) & " found."
For index = 0 To searchResult.Updates.Count - 1
    Set update = searchResult.Updates.Item(index)
    WScript.Echo "Hiding update: " & update.Title
    update.IsHidden = True
Next

您也可以在Windows中完成上述所有操作。我在VBScript中创建脚本最初是因为我希望在安装PoSH之前与进行交互。Windows是记录在MSDN上。

票数 14
EN

Server Fault用户

发布于 2010-05-27 13:10:34

如果使用的是WSUS,则可以拒绝更新。否则我就不知道怎么做了。

票数 0
EN

Server Fault用户

发布于 2010-05-27 15:18:52

在Windows应用程序中(在Vista和7上),右键单击要阻止的更新并选择“隐藏更新”。这将从列表中删除它,并阻止在自动安装期间安装它。你可以在将来的任何时候“恢复”隐藏的更新,这样它就会出现在列表上。

在旧样式的Windows网站(用于Windows )上有一个类似的过程,您可以在这个过程中隐藏更新。然而,这样做的选择是在不同的地方。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/145843

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档