Tuesday, July 19, 2011

How to List All Installed Applications From the Command Line

How to easily create a list of all programs and (MSI) packages installed on a system for later processing? That sounds like a simple task, and it is. Interestingly, a quick web search revealed primarily more complex solutions where a script is used to iterate through the uninstall information in the registry. That not only is far too complicated, but also inaccurate.

Putting WMIC to Work

As often, the local WMI database contains all the information we need. The simplest way of extracting the required data is via the WMI command line, wmic:

wmic product

Yes, that is all. It runs for a while and then spits out very detailed information on what is installed on the local system. If you need the information in a file for later processing, use the following variation of above command to have wmic create a CSV file:

wmic product get /format:csv > Software_%Computername%.csv

The result is a nice complete list in CSV format in a file that already contains the computer name for easier processing later on. Here is some sample output from my machine:

Node,AssignmentType,Caption,Description,HelpLink,HelpTelephone,IdentifyingNumber,InstallDate,InstallDate2,InstallLocation,InstallSource,InstallState,Language,LocalPackage,Name,PackageCache,PackageCode,PackageName,ProductID,RegCompany,RegOwner,SKUNumber,Transforms,URLInfoAbout,URLUpdateInfo,Vendor,Version,WordCount NB-HKLEIN,1,Microsoft Office Visual Web Developer 2007,Microsoft Office Visual Web Developer 2007,,,{90120000-0021-0000-0000-0000000FF1CE},20091110,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0021-0000-0000-0000000FF1CE}-C\,5,0,C:\Windows\Installer\47a476.msi,Microsoft Office Visual Web Developer 2007,C:\Windows\Installer\47a476.msi,{8F0496DA-7F60-40C3-871B-DA76B0DABD0C},VisualWebDeveloperWW.msi,82503-694-0000007-62461,sepago GmbH,Helge Klein,,C:\Windows\Installer\{90120000-0021-0000-0000-0000000FF1CE}\ShellUI.MST,,,Microsoft Corporation,12.0.4518.1066,2 NB-HKLEIN,1,Microsoft Office Visual Web Developer MUI (English) 2007,Microsoft Office Visual Web Developer MUI (English) 2007,,,{90120000-0021-0409-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0021-0409-0000-0000000FF1CE}-C\,5,1033,C:\Windows\Installer\47a46c.msi,Microsoft Office Visual Web Developer MUI (English) 2007,C:\Windows\Installer\47a46c.msi,{1B68F013-A620-44FC-BC81-4F7A8B8375A0},VisualWebDeveloperMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Visio Professional 2007,Microsoft Office Visio Professional 2007,,,{90120000-0051-0000-0000-0000000FF1CE},20091014,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0051-0000-0000-0000000FF1CE}-C\,5,0,C:\Windows\Installer\2b3646.msi,Microsoft Office Visio Professional 2007,C:\Windows\Installer\2b3646.msi,{821068B0-013F-40CE-A1D0-37B087A8FF2F},VisProWW.msi,89405-861-5535692-63715,sepago GmbH,Helge Klein,,C:\Windows\Installer\{90120000-0051-0000-0000-0000000FF1CE}\ShellUI.MST,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office OneNote MUI (German) 2007,Microsoft Office OneNote MUI (German) 2007,,,{90120000-00A1-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-00A1-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b35dd.msi,Microsoft Office OneNote MUI (German) 2007,C:\Windows\Installer\2b35dd.msi,{41063EDF-1369-4DD6-AE98-7878A8021E0B},OneNoteMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office InfoPath MUI (German) 2007,Microsoft Office InfoPath MUI (German) 2007,,,{90120000-0044-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0044-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b3588.msi,Microsoft Office InfoPath MUI (German) 2007,C:\Windows\Installer\2b3588.msi,{BD4F14DE-A9E4-4B93-887F-790DC2ADB443},InfoPathMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Visio MUI (German) 2007,Microsoft Office Visio MUI (German) 2007,,,{90120000-0054-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0054-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b3625.msi,Microsoft Office Visio MUI (German) 2007,C:\Windows\Installer\2b3625.msi,{079E3665-529F-4D94-AAF0-E057A1C63343},VisioMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Access MUI (German) 2007,Microsoft Office Access MUI (German) 2007,,,{90120000-0015-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0015-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b35d5.msi,Microsoft Office Access MUI (German) 2007,C:\Windows\Installer\2b35d5.msi,{5BCE6E56-AE94-4509-8D68-47F2AE3E87E1},AccessMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Shared Setup Metadata MUI (English) 2007,Microsoft Office Shared Setup Metadata MUI (English) 2007,,,{90120000-0115-0409-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0115-0409-0000-0000000FF1CE}-C\,5,1033,C:\Windows\Installer\47a464.msi,Microsoft Office Shared Setup Metadata MUI (English) 2007,C:\Windows\Installer\47a464.msi,{B098E01B-7F1F-48DC-8A6D-2243E942FD6F},OfficeMUISet.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Excel MUI (German) 2007,Microsoft Office Excel MUI (German) 2007,,,{90120000-0016-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0016-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b3566.msi,Microsoft Office Excel MUI (German) 2007,C:\Windows\Installer\2b3566.msi,{194C8759-3D69-46DD-B05C-4CB4A1FA6000},ExcelMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office PowerPoint MUI (German) 2007,Microsoft Office PowerPoint MUI (German) 2007,,,{90120000-0018-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0018-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b3578.msi,Microsoft Office PowerPoint MUI (German) 2007,C:\Windows\Installer\2b3578.msi,{7449EBEE-BAD7-4D44-96C6-F23996C7B613},PowerPointMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Publisher MUI (German) 2007,Microsoft Office Publisher MUI (German) 2007,,,{90120000-0019-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0019-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b35c3.msi,Microsoft Office Publisher MUI (German) 2007,C:\Windows\Installer\2b35c3.msi,{2439A177-3D7B-415E-8B2D-6885571CA072},PublisherMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Outlook MUI (German) 2007,Microsoft Office Outlook MUI (German) 2007,,,{90120000-001A-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-001A-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b356f.msi,Microsoft Office Outlook MUI (German) 2007,C:\Windows\Installer\2b356f.msi,{20612ECC-02E8-42B6-89A7-0C52005ED9DB},OutlookMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Office 64-bit Components 2007,Microsoft Office Office 64-bit Components 2007,,,{90120000-002A-0000-1000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{91120000-002E-0000-0000-0000000FF1CE}-C\,5,0,C:\Windows\Installer\2b35e6.msi,Microsoft Office Office 64-bit Components 2007,C:\Windows\Installer\2b35e6.msi,{BB540498-3B22-45D7-8E2F-F80F8C08354E},Office64WW.msi,,,,,C:\Windows\Installer\{90120000-002A-0000-1000-0000000FF1CE}\ShellUI.MST,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Shared 64-bit MUI (German) 2007,Microsoft Office Shared 64-bit MUI (German) 2007,,,{90120000-002A-0407-1000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-002A-0407-1000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b3590.msi,Microsoft Office Shared 64-bit MUI (German) 2007,C:\Windows\Installer\2b3590.msi,{BF63F822-3F4B-4B71-8F56-371FEF051B70},Office64MUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Groove MUI (German) 2007,Microsoft Office Groove MUI (German) 2007,,,{90120000-00BA-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-00BA-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b3580.msi,Microsoft Office Groove MUI (German) 2007,C:\Windows\Installer\2b3580.msi,{9062E123-7F0D-48E7-A4EB-07FA087EC55D},GrooveMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Word MUI (German) 2007,Microsoft Office Word MUI (German) 2007,,,{90120000-001B-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-001B-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b35cc.msi,Microsoft Office Word MUI (German) 2007,C:\Windows\Installer\2b35cc.msi,{D0FEB987-B949-4FBB-9443-8EF5E4C63B24},WordMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Proofing (German) 2007,Microsoft Office Proofing (German) 2007,,,{90120000-002C-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-002C-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b35bb.msi,Microsoft Office Proofing (German) 2007,C:\Windows\Installer\2b35bb.msi,{9DF79774-8369-46FD-AB0F-29C4BE379FB7},Proofing.msi,,,,,,,,Microsoft Corporation,12.0.4518.1014,2 NB-HKLEIN,1,Microsoft Office Shared MUI (German) 2007,Microsoft Office Shared MUI (German) 2007,,,{90120000-006E-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-006E-0407-0000-0000000FF1CE}-C\,5,1031,C:\Windows\Installer\2b355e.msi,Microsoft Office Shared MUI (German) 2007,C:\Windows\Installer\2b355e.msi,{1DE51602-63F6-4ACA-AF7E-787D1DA2C87B},OfficeMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Shared MUI (English) 2007,Microsoft Office Shared MUI (English) 2007,,,{90120000-006E-0409-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-0115-0409-0000-0000000FF1CE}-C\,5,1033,C:\Windows\Installer\47a45c.msi,Microsoft Office Shared MUI (English) 2007,C:\Windows\Installer\47a45c.msi,{3A4478D0-B2FD-4A3C-8C5F-889692F35C99},OfficeMUI.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Proof (Italian) 2007,Microsoft Office Proof (Italian) 2007,,,{90120000-001F-0410-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-002C-0407-0000-0000000FF1CE}-C\Proof.it\,5,1040,C:\Windows\Installer\2b3598.msi,Microsoft Office Proof (Italian) 2007,C:\Windows\Installer\2b3598.msi,{27C30CC2-60AB-4AF3-BEF6-FBCD8EA92802},Proof.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Proof (German) 2007,Microsoft Office Proof (German) 2007,,,{90120000-001F-0407-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-002C-0407-0000-0000000FF1CE}-C\Proof.de\,5,1031,C:\Windows\Installer\2b35a1.msi,Microsoft Office Proof (German) 2007,C:\Windows\Installer\2b35a1.msi,{4C5774D8-1C30-42A7-AA9C-E8C9F1A22970},Proof.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Proof (English) 2007,Microsoft Office Proof (English) 2007,,,{90120000-001F-0409-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-002C-0407-0000-0000000FF1CE}-C\Proof.en\,5,1033,C:\Windows\Installer\2b35b3.msi,Microsoft Office Proof (English) 2007,C:\Windows\Installer\2b35b3.msi,{FCE6A278-C1AE-431F-BBCA-EA6CF34C0BCF},Proof.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Proof (French) 2007,Microsoft Office Proof (French) 2007,,,{90120000-001F-040C-0000-0000000FF1CE},20090901,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{90120000-002C-0407-0000-0000000FF1CE}-C\Proof.fr\,5,1036,C:\Windows\Installer\2b35aa.msi,Microsoft Office Proof (French) 2007,C:\Windows\Installer\2b35aa.msi,{A57F3989-21C1-4267-9019-088688971275},Proof.msi,,,,,,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Office Ultimate 2007,Microsoft Office Ultimate 2007,,,{91120000-002E-0000-0000-0000000FF1CE},20100113,,C:\Program Files (x86)\Microsoft Office\,C:\MSOCache\All Users\{91120000-002E-0000-0000-0000000FF1CE}-C\,5,0,C:\Windows\Installer\2b35f1.msi,Microsoft Office Ultimate 2007,C:\Windows\Installer\2b35f1.msi,{C633FD41-60F4-4BF5-B60F-D5B473AE9127},UltimaterWW.msi,81608-861-1008552-65194,sepago GmbH,Helge Klein,,C:\Windows\Installer\{91120000-002E-0000-0000-0000000FF1CE}\ShellUI.MST,,,Microsoft Corporation,12.0.6425.1000,2 NB-HKLEIN,1,Microsoft Application Error Reporting,Microsoft Application Error Reporting,http://support.microsoft.com,,{95120000-00B9-0409-1000-0000000FF1CE},20091026,,,F:\1a7cba7f5674b7973ea697\PreReq\Watson\amd64\,5,1033,C:\Windows\Installer\50aef01.msi,Microsoft Application Error Reporting,C:\Windows\Installer\50aef01.msi,{F47058A9-F4BF-420D-B567-104C552A3F63},dw20sharedamd64.msi,,,,,,http://support.microsoft.com,,Microsoft Corporation,12.0.6015.5000,2 NB-HKLEIN,1,Microsoft Windows SDK for Visual Studio 2008 SP1 Tools,Microsoft Windows SDK for Visual Studio 2008 SP1 Tools,http://go.microsoft.com/fwlink/?linkid=55774,,{62EED300-E841-4083-A1D6-60B906271804},20090902,,,C:\Users\hklein\AppData\Local\Temp\IXP05D7A.tmp\wcu\winsdk\,5,1033,C:\Windows\Installer\47a506.msi,Microsoft Windows SDK for Visual Studio 2008 SP1 Tools,C:\Windows\Installer\47a506.msi,{EF4F5D7E-FD77-4634-B9A9-C05AD3C5C46F},VistaClientSDKTools-x64.msi,12345-111-1111111-99479,,hklein,,,,http://go.microsoft.com/fwlink/?linkid=55774,Microsoft Corporation,6.1.5294.17011,0 NB-HKLEIN,1,Microsoft Network Monitor 3.3,Microsoft Network Monitor 3.3,,,{365C5A10-6561-454F-B975-56EA878D0A06},20091216,,,C:\Users\HKLEIN~1.SEP\AppData\Local\Temp\IXP000.TMP\,5,1033,C:\Windows\Installer\162356b.msi,Microsoft Network Monitor 3.3,C:\Windows\Installer\162356b.msi,{315EB3CE-C69D-4965-92DB-4B6333C37DD2},netmon.msi,none,,hklein,,,,,Microsoft Corporation,3.3.1641.0,2 NB-HKLEIN,1,Microsoft Visual Studio Team System 2008 Development Edition - ENU,Microsoft Visual Studio Team System 2008 Development Edition - ENU,,,{6721AC10-3743-38F1-B178-C0EC6C9A4108},20091014,,,h:\,5,1033,C:\Windows\Installer\47a4a1.msi,Microsoft Visual Studio Team System 2008 Development Edition - ENU,C:\Windows\Installer\47a4a1.msi,{E5CAF2F5-394A-4BAC-857E-1846B024872B},vs_setup.msi,91904-270-8202896-60643,Microsoft,Microsoft,,,,,Microsoft Corporation,9.0.30729,0 NB-HKLEIN,1,ActivePerl 5.10.1 Build 1006,ActivePerl 5.10.1 Build 1006,http://www.activestate.com/Support/index.html,,{E7DF4F40-A0CE-430E-8B3B-DB7C8DF1C1A2},20090916,,C:\Program Files (x86)\Perl\,D:\temp\,5,1033,C:\Windows\Installer\2746354.msi,ActivePerl 5.10.1 Build 1006,C:\Windows\Installer\2746354.msi,{1FF10207-45B8-44CC-81B0-ECA3FD866665},ActivePerl-5.10.1.1006-MSWin32-x86-291086.msi,none,,hklein,,,http://www.activestate.com/,http://www.activestate.com/ASPN/Downloads/ActivePerl,ActiveState,5.10.1006,2 [...]

References

Examples that show how to use WMIC commands from Microsoft

Ask the Performance Team blog: Group policy filtering of installed applications

No comments:

Post a Comment