Script to get a list of Add Remove programs from WMI
In many cases with SMS or SCCM we could see that the information pulled by the hardware inventory is not matching or incorrect you can use this. This will pull the information of list of programs listed in ADD\Remove Programs
Script
=================================================================================
strHost = "."
Const HKLM = &H80000002
Set objReg = GetObject("winmgmts://" & strHost & _
"/root/default:StdRegProv")
Const strBaseKey = _
"Software\Microsoft\Windows\CurrentVersion\Uninstall\"
objReg.EnumKey HKLM, strBaseKey, arrSubKeys
For Each strSubKey In arrSubKeys
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"DisplayName", strValue)
If intRet <> 0 Then
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"QuietDisplayName", strValue)
End If
If (strValue <> "") and (intRet = 0) Then
WScript.Echo strValue
End If
Next
========================================================================
Note : It is better to use cscript for this as if you use script then it will give you lot of out screens equals to no of programs in the system. So save the script in a files with .vbs extension and run cscript <Name.vbs>
Hope this should be useful
Sudheesh Narayanaswamy
Comments
Anonymous
August 11, 2010
This is awesome! But what modifications should be made to see product version number next to product name?Anonymous
January 15, 2012
Don't forget that for 64-bit OS you also need to look at SoftwareWow6432NodeMicrosoftWindowsCurrentVersionUninstallAnonymous
January 17, 2013
wmic /output [file] product get name,versionAnonymous
February 26, 2015
Hi all, it's not correct script, because appwiz.cpl uses 5 different registry keys to create addremove list. This script reads only one and doesn't check SystemComponentAnonymous
April 09, 2015
Donec: yeah, I am starting to feel that as well. I cannot find my application using WMI queries, but it is listed in Add/Remove. Where would I check for the SystemComponent ?