Software Inventory

21 views
Skip to first unread message

Troy Jerkins

unread,
Oct 4, 2002, 9:02:01 AM10/4/02
to
I need to inventory installed software programs on remote/local systems. The
WIN32_InstalledSoftwareElement gives me waaayyy too much information. All I
really want is what is exposed through the Add/Remove programs control
panel. Is there a class that will do this or would it just be easier to
query the HKLM\Software\Microsoft\Windows\Uninstall key? What does SMS use
to do it's software metering/inventory?

Regards,

-Troy


Torgeir Bakken (MVP)

unread,
Oct 4, 2002, 9:56:29 AM10/4/02
to
Troy Jerkins wrote:

Hi

The Win32_InstalledSoftwareElement and Win32_Product will only give you
information about software that is installed by Microsoft Installer.

Here is a script that enumerates the Uninstall part in registry. Run it with
cscript.exe from a command prompt:


sComputerName = "." ' use "." for local computer

sInstApps = InstalledApplications(sComputerName)

' text block
WScript.Echo sInstApps


' Convert to Array
aInstApps = Split(sInstApps, vbCrlf)

For Each sApp In aInstApps
If sApp <> "" Then
WScript.Echo sApp
End If
Next

' alternativly
'For i = 0 To UBound(aInstApps)
' If aInstApps(i) <> "" Then
' WScript.Echo aInstApps(i)
' End If
'Next

Function InstalledApplications(node)
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set oRegistry = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& node & "/root/default:StdRegProv")
sBaseKey = _
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
For Each sKey In arSubKeys
iRC = oRegistry.GetStringValue( _
HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then
oRegistry.GetStringValue _
HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If sValue <> "" Then
InstalledApplications = _
InstalledApplications & sValue & vbCrLf
End If
Next
End Function


--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway


Troy Jerkins

unread,
Oct 4, 2002, 10:44:26 AM10/4/02
to
Thanks! I'm doing this with ASP but, That'll get me goin'!

-Troy

"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:3D9D9E0C...@hydro.com...

Slytherin

unread,
Oct 24, 2002, 3:50:59 AM10/24/02
to
OK Looks to me that I need it too but be more specific in ASP/VB if
that is possible. Class name will be helpful as well.

Thanks in Advance

Reply all
Reply to author
Forward
0 new messages