In a follow-up to my posts on using WMI to catalog system components, here’s what I do to separate my software into groups that make the most sense to what I and my department use:
First, you need to create recordsets of the different software apps:
Set colSoftware = WMIService.ExecQuery("Select * from Win32_Product where _
Vendor <> ‘Environmental Systems Research Institute, Inc.’ and _
Vendor <> ‘Microsoft Corporation’ and Vendor <> ‘Microsoft’ and _
Vendor <> ‘Environmental System Research Institute, Inc.’”)
Set esriSoftware = WMIService.ExecQuery _
(”Select * from Win32_Product where Vendor = ‘Environmental Systems Research Institute, Inc.’ or Vendor = ‘Environmental System Research Institute, Inc.’”)
Set msSoftware = WMIService.ExecQuery(”Select * from Win32_Product where _
Vendor = ‘Microsoft Corporation’ or Vendor = ‘Microsoft’”)
You should end up with three sets of software app information - colSoftware (for General apps), esriSoftware (for ESRI apps), and msSoftware (for Microsoft apps). The key thing here is that it takes some trial and error to get them in the right group - you’ll notice how both ESRI and Microsoft have more than one Vendor string.
After that it’s a simple matter of listing the software out. Here’s a sample to get you started:
OutputFile.Writeline "ESRI Applications" & Space(34) & "Version" & Space(15) & "Installed"
OutputFile.Writeline String(50, "-") & " " & String(21, "-") & " " & String(10, "-")
For Each objSoftware In esriSoftware
sAppName = objSoftware.Name
sVersion = objSoftware.Version
InstallDate = Left(CStr(objSoftware.InstallDate2), 4) & "-" & Mid(CStr(objSoftware.InstallDate2), 5, 2) & "-" & _
Mid(CStr(objSoftware.InstallDate2), 7, 2)
OutputFile.Writeline sAppName & " " & sVersion & InstallDate
Next
Make a note of the formatting for the Install Date. That’s a personal preference of mine, and can be easily changed.









0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment