15

We recently switched our Windows software packages from RPM (cygwin) to MSI (wix). Having a native packaging is a much welcome change and we intend to stick with it. However, MSI feels overly complicated for what it does and doesn't seem to provide some basic abilities. But I'm probably mistaken.

Is there a way to list all installed MSI from the command line ?

Community
  • 1
  • 1
bltxd
  • 8,825
  • 5
  • 30
  • 44

3 Answers3

13

You may use PowerShell and Windows Management Instrumentation (WMI). Here is a one liner:

Get-WmiObject -Class win32_product

Here is help for the Get-WmiObject cmdlet:

http://technet.microsoft.com/en-us/library/dd315295.aspx

Here is a sample where we select the first installed program and format it as a table:

PS C:\Users\knut> Get-WmiObject -Class win32_product |
>> select -First 1 | ft Name, Version, Vendor -AutoSize
>>

Name             Version  Vendor
----             -------  ------
AWS SDK for .NET 1.2.0200 Amazon Web Services Developer Relations
knut
  • 4,699
  • 4
  • 33
  • 43
  • See similar answer here: http://stackoverflow.com/questions/29937568/how-can-i-find-the-product-guid-of-an-installed-msi-setup/29937569 – Stein Åsmul Aug 17 '16 at 15:22
  • For some reason doesn't list '3CXPhone for Windows' version 16.3.0.220 that I cannot get removed from the list (says it's already uninstalled). Its not even under `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall`. `winget upgrade` does see it as well as that version – Henk Poley Oct 20 '21 at 07:21
  • Ah it's parked under SysWoW64: `HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\3CXPhone for Windows 16.3.0.220` – Henk Poley Oct 20 '21 at 07:27
  • For reference for all(?) the locations: https://stackoverflow.com/a/29937569/273668 – Henk Poley Oct 20 '21 at 07:42
13

Mabybe this is a good starting point for you example VB Script from MSDN:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & _
    "{impersonationLevel=impersonate}!\\" & _
    strComputer & _
    "\root\cimv2")

Set colSoftware = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_Product")   

If colSoftware.Count > 0 Then

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.CreateTextFile( _
        "c:\SoftwareList.txt", True)

    For Each objSoftware in colSoftware
        objTextFile.WriteLine objSoftware.Caption & vbtab & _
        objSoftware.Version
    Next

    objTextFile.Close

Else
    WScript.Echo "Cannot retrieve software from this computer."

End If
Node
  • 21,706
  • 2
  • 31
  • 35
  • 1
    I would have prefered something to use from the command line, but this will do. Thanks. – bltxd Oct 13 '08 at 16:21
  • 1
    Go ahead and use the script from the command line, then. Use cscript.exe to run it, and do not output to file but to stdout (like so: WScript.Echo objSoftware.Caption & vbtab & objSoftware.Version). All the FSO stuff is not needed then anymore. – Tomalak Oct 13 '08 at 16:24
5

I'm not sure if this is what you need but you can query the uninstall list from the command line with:

REG QUERY HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
Ferruccio
  • 98,941
  • 38
  • 226
  • 299
  • Excellent: However, there is a small typo. It should read: 'HKLM' not 'HLKM' (HKEY_LOCAL_MACHINE). – Martin Jun 29 '11 at 14:00