Solved

Vbscript: Finding Installed Software

Posted on 2004-10-12
3
5,027 Views
Last Modified: 2012-05-05
I'm finishing up a script that enumerates all computers on a domain I admin and shoots a bunch of hardware and software info for each machine into a database. I've been playing around with the Win32_Product class to find software installed, but it only returns packages installed with the windows installer. That's ok, but not great. Is there a somewhat simple way to find all programs installed? Do I have to go digging around in the registry? Thanks in advance.
0
Comment
Question by:matt_mcswain
3 Comments
 
LVL 5

Accepted Solution

by:
naiea1231 earned 500 total points
ID: 12294715
I've experimented with this in the past and i find the best way is to look at the uninstall part of the registry

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

If you enumerate all the keys in there, and then look at the value for the DisplayName for each one, that should give you a good indication of all the software installed (at least, all those present in add/remove programs)

If you'd like any assistance with the code for reading from the registry just let me know


James
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12294785
Well Microsoft Windows Scripting Guide is a good place to look for it should be in MSDN on your machine if you often use Scripting

I found exactly what you want



Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("c:\software.tsv", True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_Product")
objTextFile.WriteLine "Caption" & vbtab & _
"Description" & vbtab & "Identifying Number" & vbtab & _
"Install Date" & vbtab & "Install Location" & vbtab & _
"Install State" & vbtab & "Name" & vbtab & _
"Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
 & "Version"
For Each objSoftware in colSoftware
 objTextFile.WriteLine objSoftware.Caption & vbtab & _
 objSoftware.Description & vbtab & _
 objSoftware.IdentifyingNumber & vbtab & _
 objSoftware.InstallLocation & vbtab & _
 objSoftware.InstallState & vbtab & _
 objSoftware.Name & vbtab & _
 objSoftware.PackageCache & vbtab & _
 objSoftware.SKUNumber & vbtab & _
 objSoftware.Vendor & vbtab & _
 objSoftware.Version
Next
objTextFile.Close


A few comments on it:
It opens a File Software.tsv (basically a text file, Tab Separated Values)
Then it initializes a colSoftware Querying the Installed Products and Writes them in the File Software.tsv
0
 
LVL 11

Author Comment

by:matt_mcswain
ID: 12295169
Thanks James
That's exactly what I wanted; two loops and that was it. I just have to format it neatly. I'll probably use the DisplayName, DisplayVersion,Publisher, and Unistall entries. That should be sufficient. It's almost too much now. But better than not enough.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
When i run adoquery my application freezes 26 166
Exchange 2016 Setup - Incomplete installation - then it just hangs at 0% 36 168
Help Required 3 95
Query Syntax 17 34
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
A short article about problems I had with the new location API and permissions in Marshmallow
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

776 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