Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Vbscript: Finding Installed Software

Posted on 2004-10-12
3
Medium Priority
?
5,035 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

Industry Leaders: 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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

618 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