A script to list out the Add/Remove Program entries …

Created a script to dump out the contents of Add/Remove Programs.

The output looks like this:

add_remove_output

The VBscript follows below the break:

On Error Resume Next
Dim strHost,sAddRemTmp,iRegRC
Const strBaseKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"   
Const HKeyName_LOCAL_MACHINE = &H80000002
strHost = "."
sAddRemTmp = ""
iRegRC = 0

Set objReg = GetObject("winmgmts://" & strHost & "/root/default:StdRegProv")

iRegRC = objReg.EnumKey (HKeyName_LOCAL_MACHINE, strBaseKey, arrSubKeys)
If iRegRC <> 0 Then
    WScript.Quit
End If
For Each strSubKey In arrSubKeys
    intAddRemRet = objReg.GetStringValue(HKeyName_LOCAL_MACHINE, strBaseKey & strSubKey, "DisplayName", strAddRemValue)
       If intAddRemRet <> 0 Then
              intAddRemRet = objReg.GetStringValue(HKeyName_LOCAL_MACHINE, strBaseKey & strSubKey, "QuietDisplayName", strAddRemValue)
    End If
      If (strAddRemValue <> "") and (intAddRemRet = 0) Then
           strAddRemValue = Trim(strAddRemValue)
        iAddRemRC = objReg.GetStringValue(HKeyName_LOCAL_MACHINE, strBaseKey & strSubKey, "DisplayVersion", sAddRemVersion)
        If (sAddRemVersion <> "" and sAddRemVersion <> "1") Then
                 sAddRemTmp = sAddRemTmp + strAddRemValue + vbTab + "Ver: " + sAddRemVersion +VbCrLf
        Else
            If sAddRemVersion = "1" Then
                iAddRemRC2 = objReg.GetStringValue(HKeyName_LOCAL_MACHINE, strBaseKey & strSubKey, "HelpLink", sAddRemVersion)
               Else
                iAddRemRC2 = objReg.GetStringValue(HKeyName_LOCAL_MACHINE, strBaseKey & strSubKey, "MoreInfoURL", sAddRemVersion)
               End If       
            If sAddRemVersion <> "" Then
                If sAddRemVersion = "1" Then
                    iAddRemRC3 = InStrRev(sAddRemVersion, "http://support.microsoft.com?kbid=")
                   Else
                    iAddRemRC3 = InStrRev(sAddRemVersion, "http://support.microsoft.com/kb/")
                End If
                If iAddRemRC3 <> 0 Then
                       sLen = Len(sAddRemVersion) - 32
                       sAddRemVersion = "KB" + right(sAddRemVersion,sLen)
                Else
                    sAddRemVersion = "MoreInfoURL: " + sAddRemVersion
                End If
                   sAddRemTmp = sAddRemTmp + strAddRemValue + vbTab + "Ver: " + sAddRemVersion +VbCrLf
              Else
                   sAddRemTmp = sAddRemTmp + strAddRemValue +VbCrLf
               End If
           End If
       End If
Next

sAddRemTmp = BubbleSort(sAddRemTmp)
WScript.Echo sAddRemTmp

WScript.Quit
Function BubbleSort(sAddRemTmp)
  'cheapo bubble sort
  Dim aTmp, i, j, temp, bNoSwap
  aTmp = Split(sAddRemTmp, vbcrlf) 
  For i = UBound(aTmp) - 1 To 0 Step -1
      bNoSwap = False
    For j = 0 to i - 1
      If LCase(aTmp(j)) > LCase(aTmp(j+1)) Then
        temp = aTmp(j + 1)
        aTmp(j + 1) = aTmp(j)
        aTmp(j) = temp
        bNoSwap = True
      End If
    Next
    If bNoSwap = False Then
        Exit For
    End If
  Next
  BubbleSort = Join(aTmp, vbcrlf)
End Function