Computing.Net > Forums > Programming > Batch or Vbs for programs

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch or Vbs for programs

Reply to Message Icon

Name: gunslingor
Date: March 31, 2009 at 07:52:11 Pacific
OS: Windows XP
Subcategory: General
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: lucas999
Date: March 31, 2009 at 09:18:51 Pacific
Reply:

Use Win32 api (COM interfaces) to list them


0

Response Number 2
Name: gunslingor
Date: March 31, 2009 at 09:39:21 Pacific
Reply:

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?


0

Response Number 3
Name: reno
Date: March 31, 2009 at 22:45:26 Pacific
Reply:

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/?


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


C++ And FTP text file list



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch or Vbs for programs

Batch File OR VBS www.computing.net/answers/programming/batch-file-or-vbs/20369.html

Batch or VBS help www.computing.net/answers/programming/batch-or-vbs-help/13071.html

Batch f or vbs; verify a registry k www.computing.net/answers/programming/batch-f-or-vbs-verify-a-registry-k/14916.html