Function getApps(strComputer)
HKLM = &H80000002 'HKEY_LOCAL_MACHINE
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
strComputer & "/root/default:StdRegProv")
If Err.Number > 0 Then
getApps = False
Err.Clear
Exit Function
End If
objReg.EnumKey HKLM, strKey, arrSubkeys
arrInstalledApps = Array()
For Each strSubkey In arrSubkeys
'====== Display Name ========
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, "DisplayName", strValue1)
If intRet1 <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, "QuietDisplayName", strValue1
End If
If InStr(strValue1, "Hotfix") Or InStr(strValue1, "Security Update") Or InStr(strValue1, "Update for Windows") Then
'Nothing
Elseif strValue1 <> "" Then
ReDim Preserve arrInstalledApps(UBound(arrInstalledApps) + 1)
arrInstalledApps(UBound(arrInstalledApps)) = strValue1
End If
Next
getApps = arrInstalledApps
End Function
Now I'm sure you want to know how to access the function too so here's the code you need to do just that.
On Error Resume Next
strComputer = "."
arrIA = getApps(strComputer)
If IsArray(arrIA) Then
WScript.Echo "There are " & UBound(arrIA)+1 & " applications installed on " & UCase(strComputer) & VbCrLf
i = 1
For Each strApp In arrIA
WScript.Echo i & ": " & strApp
i = i + 1
Next
Else
WScript.Echo "Unable to connect."
End If