?
Solved

Vbscript: Finding Installed Software

Posted on 2004-10-12
3
Medium Priority
?
5,033 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
naiea1231 earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Make the most of your online learning experience.
Progress
Starting up a Project
Suggested Courses

770 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