#1 03 Nov 2011 17:54

biatche
Member
Registered: 01 Nov 2011
Posts: 14

hiding windows updates based on KB######

var updateSession = WScript.CreateObject("Microsoft.Update.Session");
var updateSearcher = updateSession.CreateUpdateSearcher();
updateSearcher.Online = false;

// this part must be changed? this is the language pack section. I want to search the entire database that isn't installed and filter by KB###### rather than category.
var searchResult = updateSearcher.Search("CategoryIDs Contains 'cd5ffd1e-e932-4e3a-bf74-18bf0b1bbd83' And IsInstalled=0");

for(var i=0; i<searchResult.Updates.Count; i++){
  var update = searchResult.Updates.Item(i);
  WScript.echo("Hiding:" + update.Title);
  update.IsHidden = true;
}

I can't work out how to modify/complete this script so that it will hide certain specific updates filtered by KBtitle

such as KB2483139 KB915597 KB971033 KB890830

actually just these 4.

Any clue?

Offline

#2 09 Jan 2012 22:32

NDog
Member
From: New Zealand
Registered: 31 May 2006
Posts: 113
Website

Re: hiding windows updates based on KB######

.

Last edited by NDog (28 Aug 2013 04:40)


cmd, vbs, ps, bash
autoit, python, swift

Offline

#3 30 Apr 2013 23:57

TwinklingLace
New Member
Registered: 30 Apr 2013
Posts: 1

Re: hiding windows updates based on KB######

How/when do you run this script?

I'm not a VBS or command shell user, but I really want to get rid of some updates, especially the Bing Desktop which refuses to heed the "hide update."

And why is Bing Desktop an "update"? Oh, it's an update to Micro$oft's grand ego... roll

Offline

#4 26 Jun 2013 06:12

NDog
Member
From: New Zealand
Registered: 31 May 2006
Posts: 113
Website

Re: hiding windows updates based on KB######

.

Last edited by NDog (24 Jun 2016 14:03)


cmd, vbs, ps, bash
autoit, python, swift

Offline

#5 14 Jan 2016 06:25

OilBelow30Barrel
New Member
Registered: 14 Jan 2016
Posts: 1

Re: hiding windows updates based on KB######

NDog wrote:

People are emailing me about this.
I have to run the vbs script three times to hide the bing desktop...
[...]
hideKBs.vbs

Actually, you only need to run it once, then have Windows check for updates so that the Windows Update GUI refreshes its list of hidden updates.

Anyway, I'm going to make some minor modifications to this script and might share it here. Thanks for making it.

Offline

#6 06 May 2016 22:25

mark99k
New Member
Registered: 06 May 2016
Posts: 1

Re: hiding windows updates based on KB######

NDog wrote:

[...]

This is so ingenious I'm almost tearing up. Thank you!!

Offline

#7 24 Jun 2016 14:02

NDog
Member
From: New Zealand
Registered: 31 May 2006
Posts: 113
Website

Re: hiding windows updates based on KB######

hide windows updates

hideKBs.vbs

' Windows 10 hide KBs - ndog
' last updated - 01/06/2017

Dim arrHideupdates(2)

' Upgrade to Windows 10
arrHideupdates(0) = "Feature update to Windows 10 Enterprise"

' Breaks Printer - cannot disable in 1703
arrHideupdates(1) = "KB3170455"

' Sysprep breakers
arrHideupdates(2) = "KB4019473" ' https://social.technet.microsoft.com/Forums/windows/en-US/b25b774e-7533-4573-af1d-a05a74393446/sysprep-fatal-error-in-10586-with-may-update?forum=win10itprosetup


Do While True
  wscript.echo "Searching for updates to hide..."
  If SetHidden() = True Then Exit Do
Loop


' Build array of windows updates - loop
Function SetHidden()
  SetHidden = True
  Set updateSession = createObject("Microsoft.Update.Session")
  Set updateSearcher = updateSession.CreateupdateSearcher()
  Set searchResult = updateSearcher.Search("IsHidden=0 and IsInstalled=0 and Type='Software'")
  For i = 0 To searchResult.Updates.Count - 1
    Set update = searchResult.Updates.Item(i)
    For j = LBound(arrHideupdates) To UBound(arrHideupdates): Do 'Loop through hideupdates array
    If arrHideupdates(j) = "" Then Exit Do 'empty Array, Continue
      If InStr(1, update.Title, arrHideupdates(j), vbTextCompare) Then
        WScript.echo "Hiding: " & update.Title
        update.IsHidden = True
        SetHidden = False
      End If
    Loop While False: Next
  Next
End Function

install pending windows updates

wua_all.vbs

Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()

WScript.Echo "Searching for updates..." & vbCRLF

Set searchResult = _
updateSearcher.Search("IsInstalled=0 and IsHidden=0 and Type='Software'")


WScript.Echo "List of applicable items on the machine:"

For I = 0 To searchResult.Updates.Count-1
  Set update = searchResult.Updates.Item(I)
  WScript.Echo I + 1 & "> " & update.Title
Next

If searchResult.Updates.Count = 0 Then
  WScript.Echo "There are no applicable updates."
  WScript.Quit
End If

WScript.Echo vbCRLF & "Creating collection of updates to download:"

Set updatesToDownload = CreateObject("Microsoft.Update.UpdateColl")

For I = 0 to searchResult.Updates.Count-1
  Set update = searchResult.Updates.Item(I)
  WScript.Echo I + 1 & "> adding: " & update.Title 
  updatesToDownload.Add(update)
Next

WScript.Echo vbCRLF & "Downloading updates..."

Set downloader = updateSession.CreateUpdateDownloader() 
downloader.Updates = updatesToDownload
downloader.Download()

WScript.Echo  vbCRLF & "List of downloaded updates:"

For I = 0 To searchResult.Updates.Count-1
  Set update = searchResult.Updates.Item(I)
  If update.IsDownloaded Then
   WScript.Echo I + 1 & "> " & update.Title 
  End If
Next

Set updatesToInstall = CreateObject("Microsoft.Update.UpdateColl")

WScript.Echo  vbCRLF & _
"Creating collection of downloaded updates to install:" 

For I = 0 To searchResult.Updates.Count-1
  set update = searchResult.Updates.Item(I)
  If update.IsDownloaded = true Then
   WScript.Echo I + 1 & "> adding:  " & update.Title 
   updatesToInstall.Add(update)
  End If
Next

WScript.Echo "Installing updates..."
Set installer = updateSession.CreateUpdateInstaller()
installer.Updates = updatesToInstall
Set installationResult = installer.Install()

'Output results of install
WScript.Echo "Installation Result: " & _
installationResult.ResultCode 
WScript.Echo "Reboot Required: " & _ 
installationResult.RebootRequired & vbCRLF 
WScript.Echo "Listing of updates installed " & _
 "and individual installation results:" 

For I = 0 to updatesToInstall.Count - 1
  WScript.Echo I + 1 & "> " & _
  updatesToInstall.Item(i).Title & _
  ": " & installationResult.GetUpdateResult(i).ResultCode
Next

Windows 7 misc

' Windows 7 hide KBs - ndog
' last updated - 24/09/2015
' Only English OSes are supported (string search includes "for Windows 7")

Dim hideupdates(16)

' International language packs
hideupdates(0) = "KB2483139"

' MSSE
hideupdates(1) = "Microsoft Security Essentials"

' Bing Toolbar
hideupdates(2) = "Bing Desktop"
hideupdates(3) = "Bing Bar"

' Skype
hideupdates(4) = "Skype for Windows"

' IE version
hideupdates(5) = "Windows Internet Explorer 9 for Windows 7"
hideupdates(6) = "Internet Explorer 10 for Windows 7"
hideupdates(7) = "Internet Explorer 11 for Windows 7"

' Adds update to windows 10 feature
hideupdates(8) = "KB3035583"
hideupdates(9) = "Upgrade to Windows 10"

' Spy services
hideupdates(10) = "KB971033"
hideupdates(11) = "KB3021917"
hideupdates(12) = "KB3075249"
hideupdates(13) = "KB3080149"

' Breaks features
hideupdates(14) = "KB2505438"
hideupdates(15) = "KB2670838"
hideupdates(16) = "KB2952664"

Windows 8 misc

' Windows 8 hide KBs - ndog
' last updated - 15/06/2015

Dim hideupdates(3)

' Bing Toolbar
hideupdates(0) = "Bing Desktop"
hideupdates(1) = "Bing Bar"

' MSSE
hideupdates(2) = "Microsoft Security Essentials"

' Skype
hideupdates(3) = "Skype"

Last edited by NDog (07 Jun 2017 12:44)


cmd, vbs, ps, bash
autoit, python, swift

Offline

Board footer

Powered by FluxBB