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.
我们最近将Windows软件包从RPM(cygwin)切换到了MSI(wix)。拥有原生包装是一个非常受欢迎的变化,我们打算坚持下去。但是,MSI对它的功能感到过于复杂,似乎并没有提供一些基本的能力。但我可能错了。
Is there a way to list all installed MSI from the command line ?
有没有办法从命令行列出所有已安装的MSI?
3 个解决方案
#1
12
Mabybe this is a good starting point for you example VB Script from MSDN:
Mabybe这是来自MSDN的示例VB脚本的一个很好的起点:
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
#2
10
You may use PowerShell and Windows Management Instrumentation (WMI). Here is a one liner:
您可以使用PowerShell和Windows Management Instrumentation(WMI)。这是一个班轮:
Get-WmiObject -Class win32_product
Here is help for the Get-WmiObject
cmdlet:
以下是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
#3
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
#1
12
Mabybe this is a good starting point for you example VB Script from MSDN:
Mabybe这是来自MSDN的示例VB脚本的一个很好的起点:
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
#2
10
You may use PowerShell and Windows Management Instrumentation (WMI). Here is a one liner:
您可以使用PowerShell和Windows Management Instrumentation(WMI)。这是一个班轮:
Get-WmiObject -Class win32_product
Here is help for the Get-WmiObject
cmdlet:
以下是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
#3
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