Sunday, December 6, 2009

How to generate installed patch report on any computer

Hi friends,

Here is the script for generating installed patch report for any computer.

1.Copy below code in notepad and save file as "update.vbs".

Wscript.echo "Script is running..."
Set objSession = CreateObject("Microsoft.Update.Session")
Wscript.echo "ObjectSession created."


Set objSearcher = objSession.CreateUpdateSearcher
Wscript.echo "objSearcher has been set."


Set objResults = objSearcher.Search("Type='Software'")
Wscript.echo "objResults has been set."


Set colUpdates = objResults.Updates
Wscript.echo "colUpdates has been set."


Wscript.echo "Starting loop."
For i = 0 to colUpdates.Count - 1


Wscript.echo ("Number " & i & ": " & colUpdates.Item(i).Title)
 
2. Now create a batchfile. Type below command in batchfile
 
cscript update.vbs > report.txt
 
3. Save both file at same location. and run batch file. A new file report.txt will be created with all installed patches.
 
Note: "Automatic updates" service should be running to complete the task.

2 comments:

  1. Script failed!
    update.vbs(12,64) Microsoft VBScript compilation error: Expected 'Next'
    System : MS XP SP3

    ReplyDelete
  2. It's not giving list of installed patches. Just showing below text..
    Microsoft (R) Windows Script Host Version 5.7
    Copyright (C) Microsoft Corporation. All rights reserved.

    ReplyDelete