Skip to content

Instantly share code, notes, and snippets.

@VertigoRay
Created March 5, 2013 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VertigoRay/5091748 to your computer and use it in GitHub Desktop.
Save VertigoRay/5091748 to your computer and use it in GitHub Desktop.
This will Query WMI for all of the Programs installed with Windows Installer - which covers about 90% of our supported applications. Results are written to ProductsInstalled.txt in the Working Dir.
Option Explicit
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Usage:
' cscript.exe ProductsInstalled.vbs
'
' Description:
' This will Query WMI for all of the Programs installed with Windows Installer - which covers about 90%
' of our supported applications. Results are written to ProductsInstalled.txt in the Working Dir.
'
' Output Format:
' [ProductCode] [InstalledProductName] ~~InstallLoc: [InstallLocation] ~~InstallSrc: [InstallSource] ~~Context: [Context]
'
' Sample Output:
' {781F8685-FF55-4D1C-9FC5-797160E418B2} Configuration Manager Client ~~InstallLoc: <> ~~InstallSrc: C:\Windows\ccmsetup\{F9BE5FE5-D87B-4958-9BBB-B613A2F4075E}\ ~~Context: 4
' {26A24AE4-039D-4CA4-87B4-2F83217013FF} Java 7 Update 13 ~~InstallLoc: <C:\Program Files (x86)\Java\jre7\> ~~InstallSrc: C:\Users\rpurvis\AppData\LocalLow\Sun\Java\jre1.7.0_13\ ~~Context: 4
' {26A24AE4-039D-4CA4-87B4-2F86417013FF} Java 7 Update 13 (64-bit) ~~InstallLoc: <C:\Program Files\Java\jre7\> ~~InstallSrc: C:\Users\rpurvis\AppData\LocalLow\Sun\Java\jre1.7.0_13_x64\ ~~Context: 4
' {1645D26D-73CA-3DED-8238-3635DB07F437} Google Chrome ~~InstallLoc: <> ~~InstallSrc: C:\Windows\ccmcache\2\ ~~Context: 4
' {1995804A-B1A2-4826-99DD-CEA1352D090B} McAfee Agent ~~InstallLoc: <C:\Program Files (x86)\McAfee\Common Framework\> ~~InstallSrc: C:\Windows\TEMP\mfe9AC2.tmp\ ~~Context: 4
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public installer, fullmsg, comp, prod, a, fso, pname, ploc, pid,contxt, sid, psorce, pcache
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("ProductsInstalled.txt", True)
' Connect to Windows Installer object
Set installer = CreateObject("WindowsInstaller.Installer")
a.writeline ("Products")
'on error resume next
For Each prod In installer.ProductsEx("", "", 7)
pid = prod.ProductCode
contxt = prod.Context
sid=prod.usersid
pname = prod.InstallProperty("InstalledProductName")
psorce=prod.InstallProperty( "InstallSource")
ploc =prod.InstallProperty( "InstallLocation")
pcache = prod.InstallProperty("LocalPackage")
a.writeline (pid & " " & pname & " ~~InstallLoc: " & ploc & " ~~InstallSrc: " & psorce & " ~~Context: " & contxt)
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment