#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: 116
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: 116
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: 116
Website

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

hide windows updates

hideKBs.vbs

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

Dim arrHideupdates(3)

' 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

' MS Silverlight endless update hang - win10 1703 - better to install manually
arrHideupdates(3) = "Microsoft Silverlight"

' Office 2016 Skype for Business - auto download with MS Office Pro installed
arrHideupdates(3) = "Skype"


Do While True
  wscript.echo "Searching for updates to hide..."
  If SetHidden() = True Then Exit Do
  wscript.echo ""
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 arrHideupdates array
    If arrHideupdates(j) = "" Then Exit Do 'empty Array, Continue
      'wscript.echo "Compare: " & update.Title & " - - - " & arrHideupdates(j)
      If InStr(1, update.Title, arrHideupdates(j), vbTextCompare) Then
        'Wscript.echo "---"
        'Wscript.echo "Match!"
        'Wscript.echo update.Title
        'wscript.echo arrHideupdates(j)
        'Wscript.echo "---"
        WScript.echo "Hiding: " & update.Title
        update.IsHidden = True
        SetHidden = False
      Else
        'WScript.echo "No match found for " & arrHideupdates(j)
      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

' restart machine
CreateObject("WScript.Shell").Run "cmd /c shutdown -r -t 0", 0, true

Windows 7 misc

' Windows 7 hide KBs - ndog
' last updated - 31/05/2018

' script will run multiple times to hide updates until 
' Only English OSes are supported (includes "for Windows 7")

Dim arrHideupdates(26)

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

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

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

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

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

' Adds update to windows 10 feature
arrHideupdates(8) = "KB3035583"
arrHideupdates(9) = "KB3184143"
arrHideupdates(10) = "KB3150513"
arrHideupdates(11) = "Upgrade to Windows 10"

' Blocks windows updates from installing on newer CPUs (https://github.com/zeffy/wufuc)
arrHideupdates(12) = "KB4012218"
arrHideupdates(13) = "KB4012219"

' Spy services
arrHideupdates(14) = "KB2952664"
arrHideupdates(15) = "KB3080149"
arrHideupdates(16) = "KB3068708"
arrHideupdates(17) = "KB3021917"
arrHideupdates(18) = "KB971033"
arrHideupdates(19) = "KB3075249"

' Breaks features
arrHideupdates(20) = "KB2505438"
arrHideupdates(21) = "KB2670838"

' Breaks audit mode
arrHideupdates(22) = "KB2729094"

' Breaks Windows - 7E STOP
' 2018-05 Quality rollups
arrHideupdates(23) = "KB4103718"
arrHideupdates(24) = "KB4103713"
' 2018-04 Quality rollups
arrHideupdates(25) = "KB4093118"
arrHideupdates(26) = "KB4093113"

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 (31 May 2018 00:16)


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

Offline

Board footer

Powered by FluxBB