Solved

Vbscript: Finding Installed Software

Posted on 2004-10-12
3
5,025 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bigHeights  challenge 13 55
allStar challenge 1 41
strDist challenge 35 84
mapBully challenge 6 88
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This article will show, step by step, how to integrate R code into a R Sweave document
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 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

11 Experts available now in Live!

Get 1:1 Help Now