我想离开Windows自动更新启用,但阻止正在安装,导致我们的问题的特定修补程序。
这可能吗? 任何人都知道如何做到这一点?
在一个更大的networking中,你将会像DanBig指出的那样使用WSUS。 但是,如果您不想阻止单个热修复程序,则可以使用以下脚本使用热修复程序ID来执行此操作:
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
如果更新未链接到知识库文章,则需要使用以下脚本查找更新ID:
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
并使用这个脚本来阻止它:
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 PowerShell中执行上述所有操作。 我在VBScript中创build了这些脚本,原因是我想在安装PoSH之前先与Windows Update Agent进行交互。 Windows Update API 在MSDN上logging 。
如果您正在使用WSUS ,则可以拒绝更新。 否则我不知道有办法。
在Windows Update应用程序(Vista和7)中,右键单击要阻止的更新,然后select“隐藏更新”。 这将从列表中删除,并在自动安装过程中阻止安装。 您可以在将来的任何时候“恢复”隐藏的更新,这样它就会出现在列表中。
在旧版Windows Update网站上(对于Windows XP),您可以在其中隐藏更新。 虽然这样做的select是在不同的地方。