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

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

I haven't deployed Windows for a long time, so these scripts are a bit out of date. Only need to run the batch file once, the vbs script handles itself.
I am not aware since 2015 if there are new annoyances to hide since I last used this script, because I am not a fan of new microsoft OS.
I still use windows XP and OS X El Capitan dual boot on all my computers

To make your life easier you can run this pre sysprep in audit mode as administrator.
This will go into an endless update and reboot cycle until the OS is fully upto date.
I have seen sometimes fully updating a vanilla windows install can take over 24 hours, so its nice to be able to leave this running overnight.
Be aware you will need to turn off automatic sleep and hibernation if you are seriously using it that way
After that you can remove the scripts, sysprep generalize and reseal shutdown then capture wim.
Just also be aware that sysprep reseal will remove the windowsupdate database file so any 'hidden' marked updates, will be reset
unless you just restore the database file after sysprep lol


Drop this script in the startup folder. (run > Shell:startup)

w10-updates-presysprep.cmd

@echo off&cls&title %~n0
color 9F
mode con: cols=32 lines=11
title update windows 10 - audit mode 1.0
:: last updated @ 28/08/2015 - ndog
:: This script runs windows updates in audit mode before sysprep
:: It should be run from the Shell:startup folder directly and removed before sysprep
:: run > Shell:startup

if exist "%WINDIR%\System32\oobe\AuditShD.exe" start "" /min "%WINDIR%\System32\oobe\AuditShD.exe"

echo Windows updates
start /wait cmd /c "%USERPROFILE%\Desktop\windowsupdates\1hideKBs.cmd"
start /wait cmd /c "%USERPROFILE%\Desktop\windowsupdates\2wua_all.cmd"
rem Pause before continue - needed if windows updates need to restart PC
ping localhost -n 15 >nul

Put these scripts on the desktop\windowsupdate folder

1hideKBs.cmd

@echo off&cls&title hide updates - Remember to be connected to internet!

echo Checking for internet connectivity needed to perform updates
echo This will try to ping google.com 4 times
echo if ping successful will update, otherwise continue without updates

ping -n 4 google.com|find "TTL" >nul
IF NOT ERRORLEVEL 1 goto :internet
IF     ERRORLEVEL 1 goto :end
:internet
echo.
echo Internet Detected
echo.

echo HideKbs.vbs
cscript //nologo "%~dp0hideKBs.vbs"

echo.
echo Finished
ping localhost -n 5 >nul

:end

2wua_all.cmd

@echo off&cls&title install latest updates - Remember to be connected to internet!

echo Checking for internet connectivity needed to perform updates
echo This will try to ping google.com 4 times
echo if ping successful will update, otherwise continue without updates

ping -n 4 google.com|find "TTL" >nul
IF NOT ERRORLEVEL 1 goto :internet
IF     ERRORLEVEL 1 goto :end
:internet
echo.
echo Internet Detected
echo.

echo run wua_all.vbs
cscript //nologo "%~dp0wua_all.vbs"

reg query "hklm\software\microsoft\windows\currentversion\windowsupdate\auto update\Rebootrequired" 2>nul
if not errorlevel 1 (
	echo.&echo Reboot is required from previous windows updates.
	shutdown -r -t 5
	)

echo.
echo Finished
ping localhost -n 5 >nul

:end
exit

hideKBs.vbs

' Windows 7 hide KBs - ndog
' last updated - 24/09/2015

' script must be run multiple times to hide Bing
' Only English OSes are supported (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"


' initialise windows update
set updateSession = createObject("Microsoft.Update.Session")
set updateSearcher = updateSession.CreateupdateSearcher()

Do While True
  ' start loop
  Set searchResult = updateSearcher.Search("IsHidden=0 and IsInstalled=0 and Type='Software'")
  nocount = 0
  ' main loop
  For i = 0 To searchResult.Updates.Count-1
    set update = searchResult.Updates.Item(i)
    For j = LBound(hideupdates) To UBound(hideupdates) 
      'MsgBox hideupdates(j)
      if instr(1, update.Title, hideupdates(j), vbTextCompare) = 0 then
        'Wscript.echo "No match found for " & hideupdates(j)
      else
        Wscript.echo "Hiding " & hideupdates(j)
        update.IsHidden = True
        nocount = nocount + 1
      end if
    Next
  Next
  ' if nocount is 0, then quit
  if nocount = 0 Then Exit Do
Loop

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



for windows 8 these are some you can hide

' 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"

for windows 10 these are some you can hide

' Windows 10 hide KBs - ndog
' last updated - 28/08/2015

Dim hideupdates(3)

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

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

' Skype
hideupdates(3) = "Skype"

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

Offline

Board footer

Powered by FluxBB