Batch or Vbs for programs

March 31, 2009 at 07:52:11
Specs: Windows XP
I have found a number of scripts that can output a list of installed programs but not really in the correct format. I would like one script to output installed programs and another script to output installed hotfixes/patches/updates. I will be calling both of these from a batch file and outputing to a text file. Anyone know where I can find such scripts or similar?

See More: Batch or Vbs for programs

Report •


#1
March 31, 2009 at 09:18:51
Use Win32 api (COM interfaces) to list them

Report •

#2
March 31, 2009 at 09:39:21
I don't know how to do that. Plus, I suspect using the api will produce a list of programs and hotfixes/updates. Also, would this method work on older machines, say win98?

Report •

#3
March 31, 2009 at 22:45:26
to output hotfixes, type:
C:\>systeminfo

to list out installed program, one of the many methods i can think of is using WMI. here is the vbs auto-generatad code by scriptomatic:

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array(".")
For Each strComputer In arrComputers
   WScript.Echo
   WScript.Echo "=========================================="
   WScript.Echo "Computer: " & strComputer
   WScript.Echo "=========================================="

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product", _
         "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

   For Each objItem In colItems
      WScript.Echo "Caption: " & objItem.Caption
      WScript.Echo "Description: " & objItem.Description
      WScript.Echo "IdentifyingNumber: " & objItem.IdentifyingNumber
      WScript.Echo "InstallDate: " & objItem.InstallDate
      WScript.Echo "InstallDate2: " & WMIDateStringToDate(objItem.InstallDate2)
      WScript.Echo "InstallLocation: " & objItem.InstallLocation
      WScript.Echo "InstallState: " & objItem.InstallState
      WScript.Echo "Name: " & objItem.Name
      WScript.Echo "PackageCache: " & objItem.PackageCache
      WScript.Echo "SKUNumber: " & objItem.SKUNumber
      WScript.Echo "Vendor: " & objItem.Vendor
      WScript.Echo "Version: " & objItem.Version
      WScript.Echo
   Next
Next


Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm: 
	WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
	Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
	& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & _
":" & Mid(dtmDate,13, 2))
End Function

for nt dos version, type wmic/?


Report •

Related Solutions


Ask Question