VBScript List all missing microsoft updates offline mode.


List all missing updates, in a windows client with no access to internet.

You will need to download the wsusscn2.cab file in this location  http://go.microsoft.com/fwlink/?LinkId=76054

Dim conputer, WshNetwork
Set WshNetwork = WScript.CreateObject(“WScript.Network”)
Set computer = WshNetwork.ComputerName
Dim FSO, OutPutFile
Const ForWriting = 2
Const ForAppending = 8
Set FSO = CreateObject(“Scripting.FileSystemObject”)
Dim EndFile, wsusscn2
EndFile = “H:\updates\” & computer & “.txt” ‘ choose the location for the output
wsusscn2 = “H:\updates\wsusscn2.cab” ‘ choose location of the cab file
Set OutPutFile = FSO.OpenTextFile(EndFile, ForWriting, True)
Set UpdateSession = CreateObject(“Microsoft.Update.Session”)
Set UpdateServiceManager = CreateObject(“Microsoft.Update.ServiceManager”)
Set UpdateService = UpdateServiceManager.AddScanPackageService(“Offline Sync Service”, wsusscn2)
Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()
UpdateSearcher.ServerSelection = 3 ‘ ssOthers
UpdateSearcher.ServiceID = UpdateService.ServiceID
Set SearchResult = UpdateSearcher.Search(“IsInstalled=0”)
Set Updates = SearchResult.Updates OutPutFile.WriteLine “Missing Patches ” & Date & computer
OutPutFile.WriteLine “.” OutPutFile.WriteLine “.”
If     SearchResult.Updates.Count = 0 Then
OutPutFile.WriteLine “There are no applicable updates.”
WScript.Quit End If For I = 0 to searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
OutPutFile.WriteLine Update.Title
Next
OutPutFile.Close
WScript.Quit

Hope that this information can be useful

Advertisements

About rodvars
Been working in IT Services/Consulting for the past 15 years. My main areas of work are planning, development, managing and administration System infrastructures focusing on optimizing user processes, enforcing business security, performance enhancements, high availabilty and infrastucture scalability.

One Response to VBScript List all missing microsoft updates offline mode.

  1. prakash says:

    Script is not working.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: