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



strHost = "."
Const HKLM = &H80000002
Set objReg = GetObject("winmgmts://" & strHost & _
Const strBaseKey = _
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


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 (5)

  1. Petr says:

    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 ?

  2. Donec says:

    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 SystemComponent

  3. anony.muos says:

    wmic /output [file] product get name,version

  4. danovich says:

    Don't forget that for 64-bit OS you also need to look at SoftwareWow6432NodeMicrosoftWindowsCurrentVersionUninstall

  5. Marmeks says:

    This is awesome!

    But what modifications should be made to see product version number next to product name?

Skip to main content