Option Explicit Dim blnFoundOne Dim i, intCount Dim objSearchResult, objWUpdate, objWUSearcher, objWUSession If WScript.Arguments.Count > 0 Then Syntax Set objWUSession = CreateObject( "Microsoft.Update.Session" ) Set objWUSearcher = objWUSession.CreateUpdateSearcher( ) objWUSearcher.Online = False blnFoundOne = True intCount = 0 While blnFoundOne WScript.Echo( "Searching..." ) blnFoundOne = False Set objSearchResult = objWUSearcher.Search( "IsHidden=0 And IsInstalled=0" ) For i = 0 To objSearchResult.Updates.Count - 1 Set objWUpdate = objSearchResult.Updates.Item(i) If InStr( objWUpdate.Title, "Microsoft Silverlight" ) > 0 Then WScript.Echo "Hiding " & objWUpdate.Title objWUpdate.IsHidden = 1 blnFoundOne = True intCount = intCount + 1 End If Set objWUpdate = Nothing Next Set objSearchResult = Nothing Wend Set objWUSearcher = Nothing Set objWUSession = Nothing Select Case intCount Case 0: WScript.Echo vbCrLf & "All optional Microsoft Silverlight updates were" _ & vbCrLf & "either installed or hidden already, no change required" Case 1: WScript.Echo vbCrLf & "Hidden 1 optional Microsoft Silverlight update" Case Else: WScript.Echo vbCrLf & "Hidden " & intCount & " optional Microsoft Silverlight updates" End Select WScript.Quit intCount Sub Syntax Dim strMsg strMsg = vbCrLf _ & "DisableSilverlightUpdates.vbs, version 1.00" _ & vbCrLf _ & "Hide all Silverlight updates in Windows Update" _ & vbCrLf & vbCrLf _ & "Usage: DisableSilverlightUpdates.vbs" _ & vbCrLf & vbCrLf _ & "Notes: If you do not wish to install Microsoft Silverlight, Windows" _ & vbCrLf _ & " Update will nag about 16 times to install it as an optional" _ & vbCrLf _ & " update; hiding each of these 16 optional updates manually is" _ & vbCrLf _ & " possible, but why not let this script automate that for you?" _ & vbCrLf _ & " This script was originally written in JScript by Tony Marques" _ & vbCrLf _ & " (https://superuser.com/a/1009947)" _ & vbCrLf _ & " I only ""translated"" it into VBScript and added the counter." _ & vbCrLf _ & " This script's return code is the number of Silverlight updates" _ & vbCrLf _ & " hidden by this script, or -1 in case of command line errors." _ & vbCrLf & vbCrLf _ & "Translated by Rob van der Woude" _ & vbCrLf _ & "http://www.robvanderwoude.com" WScript.Echo strMsg WScript.Quit -1 End Sub