Solved

Vbscript: Finding Installed Software

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
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 …
Six Sigma Control Plans

690 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