List installed programs (VBScript)
This bit of VBScript will allow you to return a list of applications installed (as seen by Add/Remove Programs). The function returns a simple Array() containing the list of applications installed.
Combined with an ADSI script that returns a list of computers, you can use this function to iterate through all machines on your network to gather a list of installed applications on each machine.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
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 |