A PowerShell function to get the installed software

Earlier this month I posted about getting the installed updates and/or hotfixes.
This got me thinking… what about installed software?
If you want to compare servers to each other, installed software may be just as important as installed updates and/or hotfixes.
However, the first step would be to get the installed software. Only after that, we’ll be able to compare them…

So, here we go. This time I’m not using PowerShell remoting, simply because there is no need to.
Remote WMI is just fine for this 🙂

My next post will be a function that utilizes the function above in order to compare installed software between devices. 🙂

*** EDIT ***

As Dave Wyatt pointed out in the comments, the above function doesn’t always work, for example on a x64 system. Next to that, the used WMI class isn’t available on all systems. This is a pesky little issue if you expect the function to work in all situations, which it should.
Dave mentioned registry keys that could be used, so I updated the post.
Then JSchell replied to me on Twitter that I wasn’t looking for apps installed on a x64 system that registered themselves under the x86 registry.
Combine those two feedbacks with my original function and you’ll get the following:


  1. digitalover says:

    I got error when I run this: Get-WmiObject : Invalid class “Win32Reg_AddRemovePrograms”

  2. Jeff Wouters says:

    What OS are you running? I’ve tested this on WS208R2 and above…

  3. Dave Wyatt says:

    According to this MSDN blog post: http://blogs.technet.com/b/askds/archive/2012/04/19/how-to-not-use-win32-product-in-group-policy-filtering.aspx , Win32Reg_AddRemovePrograms was a custom WMI class originally added by SMS, but hasn’t been updated since and doesn’t report on 32-bit software when used to query 64-bit operating systems.
    All it appears to be doing is querying the HKLMSoftwareMicrosoftWindowsCurrentVersionUninstall subkeys for their DisplayName and DisplayVersion values. To get it working properly on 64-bit systems, you’d have to include HKLMSoftwareWow6432nodeMicrosoftWindowsCurrentVersionUninstall as well.

  4. Jeff Wouters says:

    Hi Dave,
    Thanks! I’ll investigate and edit the post appropriately.

Leave a Reply

Your email address will not be published. Required fields are marked *