Hi all,

I’m trying to get a list of installed software on the systems in our network and found the following howto:

https://community.spiceworks.com/how_to/193125-listing-installed-software-on-multiple-computers

Which resulted in me making the following Powershell script:

Get-Content -Path c:\temp\pcs.txt | ForEach-Object { Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Product -Computer $_ } | Export-CSV “c:\Temp\Software\InstalledAppsWmi.csv” -Append -NoTypeInformation

I ran it on my local machine and got a csv with installed applications. To make sure this is working wel remotely over the network I had a colleague run the same script remotely on my computer. This gives us two csv files queried from the same computer, one local and one remotely. The weird thing is that the csv queried remotely has significantly less rows then the one ran locally.

Anyone any thought on what might be causing this?

Thanks,

Max.

5 Spice ups

I would advise against using Win32_Product, because it is very inefficient. It is not query-optimized and causes the OS to run a consistency check on ALL installed software.

Instead you can use Get-Package to list installed software.

“Warning Win32_Product is not query optimized. Queries such as “select * from Win32_Product where (name like ‘Sniffer%’)” require WMI to use the MSI provider to enumerate all of the installed products and then parse the full list sequentially to handle the “where” clause. This process also initiates a consistency check of packages installed, verifying and repairing the install. With an account with only user privileges, as the user account may not have access to quite a few locations, may cause delay in application launch and an event 11708 stating an installation failure. For more information, see KB Article 794524.”

2 Spice ups

Querying CIM Class Win32_Product causes a potential repair on every returned program name. I recommend never querying that.

3 Spice ups

Thanks, get-package did the trick, it does also pull all the msu’s which aren’t usefull for my querie but those are filtered out easy enough.
Not sure if this is going to work when my colleague does it remote yet, I’ll let you know if that gives the same result as when I do it locally.

Update:

I marked the question as answered to soon I’m afraid as I have some follow up questions :smiley:

When done remotely it gives a different outcome, some applications are missing (local I have less rows then remotely) and remotely it sees applications I don’t see locally (IE remotely it sees a bunch of Citrix installs but not the Baramundi management) and also for a lot (if not most) the versions vary from the local query to the remote one.

Anyone any thought?

what do you mean it gives differet result? Can you provide more details/

2 Spice ups

You can run “remote” commands against your own computer with Invoke-Command. You can enter the name of your computer or period/dot to specify local host. You can use that to test for yourself and verify the result, because the Get-Package command shoukd retirn the same result regardless of whether it was run remotely or locally.

1 Spice up

When I run the script remotely it misses certain program’s it sees when ran locally and sees other applications remotely that are not seen when ran locally. This seems to happen with any form of query I run, be it get-pacakage, get-itemproperty (registry), Get-WmiObject (which I won’t be using anymore as suggested) but all display this weird issue.

Thanks for your response, but that is the problem I mean. I tried it both locally as well as remote and the result is not the same. That’s what’s throwing me off and also is the problem because if I don’t know if the data I get is correct that’s not something I can trust to inventory the software within our domain.