Solved

Script to find all WIndows updates installed date wise list.

Posted on 2007-11-20
6
2,322 Views
Last Modified: 2010-04-21
Hi,
I am looking for a script that can get all the windows updates install on the machine to a file with the dates.

Any help....

Regards
Sharath
0
Comment
Question by:bsharath
  • 4
  • 2
6 Comments
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20320295
Try this..........


regards
Chandru
strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 

Set colQuickFixes = objWMIService.ExecQuery _

    ("Select * from Win32_QuickFixEngineering")
 

For Each objQuickFix in colQuickFixes

    Wscript.Echo "Computer: " & objQuickFix.CSName

    Wscript.Echo "Description: " & objQuickFix.Description

    Wscript.Echo "Hot Fix ID: " & objQuickFix.HotFixID

    Wscript.Echo "Installation Date: " & objQuickFix.InstallDate

    Wscript.Echo "Installed By: " & objQuickFix.InstalledBy

Next

Open in new window

0
 
LVL 11

Author Comment

by:bsharath
ID: 20320343
I get this...
Hot Fix ID: File 1
Installation Date:
Installed By:
Computer: DEV-CHEN-MRD100
Description:
Hot Fix ID: File 1
Installation Date:
Installed By:
Computer: DEV-CHEN-MRD100
Description:
Hot Fix ID: File 1
Installation Date:
Installed By:
Computer: DEV-CHEN-MRD100
Description:
Hot Fix ID: File 1
Installation Date:
Installed By:
Computer: DEV-CHEN-MRD100
Description:
Hot Fix ID: File 1

Computer: DEV-CHEN-MRD100
Description: Security Update for Windows Internet Explorer 7 (KB929969)
Hot Fix ID: KB929969
Installation Date:
Installed By: SYSTEM
Computer: DEV-CHEN-MRD100
Description: Security Update for Windows Internet Explorer 7 (KB933566)
Hot Fix ID: KB933566-IE7
Installation Date:
Installed By: SYSTEM
Computer: DEV-CHEN-MRD100
Description: Security Update for Windows Internet Explorer 7 (KB937143)
Hot Fix ID: KB937143-IE7
Installation Date:
Installed By: SYSTEM
Computer: DEV-CHEN-MRD100
Description: Security Update for Windows Internet Explorer 7 (KB938127)
Hot Fix ID: KB938127-IE7
Installation Date:
Installed By: SYSTEM


I dont get the dates...
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20321801
Woudl you mind giving this a try.........

wmic /node:'server-name' qfe GET description,FixComments,hotfixid,installedby,installedon,servicepackineffect > QFElist.txt



regards
Chandru
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 12

Expert Comment

by:chandru_sol
ID: 20321811
Hope you will like this aswelll

http://www.nirsoft.net/utils/wul.html

regards
Chandru
0
 
LVL 12

Accepted Solution

by:
chandru_sol earned 500 total points
ID: 20321893
Try this vbscript,

Usage --- Cscript //nologo HotfixHistory.vbs > HotfixHistory.txt

regards
Chandru
Wscript.Echo "Hotfix report date: " & Now & vbCrLf 

strComputer = "."   ' use "." for local computer 

Const HKLM = &H80000002 

'On Error Resume Next 

Set objWMIService = GetObject("winmgmts:" _ 

        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
 

Set colSettings = objWMIService.ExecQuery _ 

        ("Select * from Win32_OperatingSystem") 

' get general info about the OS 

' Caption value for different OS: 

' Microsoft Windows 2000 ... 

' Microsoft Windows XP ... 

' Microsoft(R) Windows(R) Server 2003, ..... Edition 

For Each objOperatingSystem in colSettings 

    strOSCaption = objOperatingSystem.Caption 

    Select Case True 

      Case InStr(1, strOSCaption, "windows 2000", vbTextCompare) > 0 

        strOS = "Windows 2000" 

      Case InStr(1, strOSCaption, "windows xp", vbTextCompare) > 0 

        strOS = "Windows XP" 

      Case InStr(1, strOSCaption, "windows(r) server 2003", vbTextCompare) > 0 

        strOS = "Windows Server 2003" 

    End Select 
 
 

    intOSLang = objOperatingSystem.OSLanguage 

    strOSLangHex = Right("000" & Hex(intOSLang), 4) 

    strOSServicePack = objOperatingSystem.CSDVersion 

Next 
 

Set objReg = GetObject("WinMgmts:{impersonationLevel=impersonate}!//" _ 

              & strComputer & "/root/default:StdRegProv") 

strOSLanguage = "Unknown"  ' Init value 

strKeyPath = "SOFTWARE\Classes\MIME\Database\Rfc1766" 

strValueName = strOSLangHex 

objReg.GetStringValue HKLM, strKeyPath, strValueName, strOSLanguage 

' remove unnecessary stuff 

arrOSLanguage = Split(strOSLanguage, ";") 

strOSLanguage = arrOSLanguage(UBound(arrOSLanguage)) 

If Instr(strOSLanguage, "(") > 0 Then 

    arrOSLanguage = Split(strOSLanguage, "(") 

    strOSLanguage = Trim(arrOSLanguage(0)) 

End If 
 
 

Wscript.Echo "OS version: " & strOSCaption 

Wscript.Echo "SP version: " & strOSServicePack 

Wscript.Echo "OS language: " & strOSLanguage 
 
 

' start enumeration of hotfixes 
 
 

Wscript.Echo vbCrLf & "Hotfixes Identified:" 
 
 

strRegBaseUpdate = "SOFTWARE\Microsoft\Updates\" & strOS 
 
 

Set colItems = objWMIService.ExecQuery _ 

        ("Select * from Win32_QuickFixEngineering",,48) 
 
 

For Each objItem in colItems 

    If objItem.HotFixID <> "File 1" Then 

       Wscript.Echo "HotFixID: " & objItem.HotFixID 

       Wscript.Echo "Description: " & objItem.Description 

       Wscript.Echo "InstalledBy: " & objItem.InstalledBy 

       strInstallDate = Null  ' init value 

       If objItem.ServicePackInEffect <> "" Then 

          strRegKey = strRegBaseUpdate & "\" & objItem.ServicePackInEffect _ 

                 & "\" & objItem.HotFixID 

          objReg.GetStringValue HKLM, strRegKey, _ 

               "InstalledDate", strInstallDate 

       End If 
 
 

       If IsNull(strInstallDate) Then 

          strInstallDate = "(none found)" 

       End If 

       Wscript.Echo "InstallDate: " & strInstallDate 

       Wscript.Echo   ' blank line 

    End If 

Next 

Open in new window

0
 
LVL 11

Author Closing Comment

by:bsharath
ID: 31410285
Thanks a lot Chandru...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to make an ADE file by code? 11 79
Compile Error 7 39
Need script to search multiple files in one drive 13 31
change the windows script file to BAT 10 25
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
The viewer will learn how to dynamically set the form action using jQuery.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now