W2KSG: Installed software

Knowing what software is installed on a machine is an important piece of information.  We can use WMI to find the software installed by Windows Installer.  Other software won’t show.

Listing 8.12

Get-WmiObject -Class Win32_product | Select Name, Caption, IdentifyingNumber, InstallLocation, Vendor, Version | Export-Csv software.txt -NoTypeInformation

A simple use of get-wmiobject to retrieve the win32_product class. We select a number of properties. Finally we export to a csv file.  The -NoTypeInformation prevents PowerShell from writing the .NET type information into the first line of the file.  This is one line of PowerShell.  The VBScript equivalent takes 26 lines – most of it to do with formatting and writing the data to the file.


Share this post :


Technorati Tags: ,

About these ads
This entry was posted in PowerShell and WMI. Bookmark the permalink.

One Response to W2KSG: Installed software

  1. Klaas says:

    Hi Richard

    I know this is a very old post, but I think it is still up to date. I have been using win32_product for three years, but today I read this article by Marc Carter: http://blogs.technet.com/b/heyscriptingguy/archive/2011/11/13/use-powershell-to-quickly-find-installed-software.aspx
    Querying win32_product seems to launch msi and other dangerous actions. It probably also explains why these queries always take a lot of time. In ‘Powershell and WMI’, listing 5.19 uses this class too. Were you aware of the issues Marc mentions?
    I’m getting afraid of WMI now I know all kind of things can happen without warning. Maybe this is worth investigating further?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s