wordpress   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了windows-update – 阻止特定的Windows更新修补程序大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我想启用 Windows自动更新但阻止安装的特定补丁导致我们出现问题. 这可能吗?谁知道怎么做? 在较大的网络中,您将需要使用WSUS,如DanBig所指出的那样.但是,如果您希望阻止单个Hot Fix,则可以使用此脚本使用Hotfix ID执行此操作: If Wscript.Arguments.Count = 0 Then WScript.Echo "Syntax: HideWindow
我想启用 Windows自动更新但阻止安装的特定补丁导致我们出现问题.

这可能吗?谁知道怎么做?

在较大的网络中,您将需要使用WSUS,如DanBig所指出的那样.但是,如果您希望阻止单个Hot Fix,则可以使用此脚本使用Hotfix 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,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中创建了脚本,因为我想在安装PoSH之前与Windows Update代理进行交互. Windows Update API是documented on MSDN.

大佬总结

以上是大佬教程为你收集整理的windows-update – 阻止特定的Windows更新修补程序全部内容,希望文章能够帮你解决windows-update – 阻止特定的Windows更新修补程序所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: