Hi all! I have been tasked with this. I would prefer to use a PS script, but do not have to. Maybe even Spiceworks has a tool for it. I am looking to find two pieces of software: Anything with Adobe in the title and MS office. I have found a couple of third party programs that will do it, but they are a bit slower than I’d like. Additionally, I would like to learn more about PowerShell and I feel this would be a good opportunity. So far I can query computers one by one, and I can get only ones that have been installed via msi.

Does anyone have any thoughts about querying an entire domain? The issue, is that I am currently scanning the endpoint registry. This is not finding the list that I am looking for (my code-foo is weak sauce in PowerShell). Is there a way to scan the appwiz using PowerShell on remote computers, or am I just trying to find the easy way to do it? If there is, or if anyone knows of a better way, your guidance would be greatly appreciated! Thank you community!

8 Spice ups

So, that’s kind of what Spiceworks does. I’d recommend just installing Spiceworks on a spare computer/VM and running a scan.

4 Spice ups

What Martin said.

I’ve read up on querying PCs for installed software and encountered a few questions on here about the same.

My conclusion is, don’t waste your time trying. You’re probably going to miss at least some software and if you query the wrong wmi_object you could cause software issues on the targeted systems.

If you are doing this purely to learn powershell then great. If you’re doing it to solve a work problem, use a program that does this work for you.

1 Spice up

I like it, Martin. I have Spiceworks installed as a server in our environment. I like what it offers and I understand what you are saying. Do you know if there is a way to create a list? As in, can I gather all the specific data that I need and export it to a spreadsheet?

Thank you, M Boyle. I feel that it your suggestion is on point. I will still attempt to do it with PowerShell, but I do not HAVE to do it this way. You are right in saying that it is for experience more than anything.

My attempt will be something that I do in my “off time” so I can learn a bit. It is not a task that needs to be accomplished right now - it will become a system so that MS audits will be less of a headache, and far less time consuming.

1 Spice up

I haven’t actually used Spiceworks in over a year and the Inventory in even longer but I’m pretty certain there is. I’ve cross posted this thread to the Spiceworks support forum and plenty of people can let you know!

1 Spice up

It’s very possible to do this with PowerShell with a combination of Registry and WMI calls. Be careful of Win32_Product because it’s evil ( Win32_Product Is Evil. | Greg's Systems Management Blog )

1 Spice up

You’re the man, Martin! The path on the website says it all :slight_smile:

That’s the one I was trying to remember.

To qualify; my reading indicated that you could get most software installed by querying the registry and wmi, but that you could miss some badly/oddly installed apps. The majority of applications will be fine as they register themselves properly.
So if you are coding a software inventory system, don’t. Let the pros handle that. But for our OP’s powershell education then it’s an interesting task and well worth the effort.

I do have a powershell script that will do this if anyone is interested. Tag me or PM me if so.

Edit: I have posted the script the OP used to solve his dilemma in the Spiceworks Script Repository at the link below.

https://community.spiceworks.com/scripts/show/3315-query-softwareinstalled

1 Spice up

I have a vbs script to query what software is installed on a remote system. not pretty but it works.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(".\software.tsv", True)

strComputer =Inputbox("Enter Tag# (tag...): ","Computer Tag Requested",".")

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
    ("Select * from Win32_Product")

objTextFile.WriteLine "Caption " & vbtab & _
    "Description" & vbtab & "Identifying Number" & vbtab & _
    "Install Date" & vbtab & "Install Location" & vbtab & _
    "Install State" & vbtab & "Name" & vbtab & _ 
    "Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
        & "Version" 

For Each objSoftware in colSoftware
    objTextFile.WriteLine objSoftware.Caption & vbtab & _
    objSoftware.Description & vbtab & _
    objSoftware.IdentifyingNumber & vbtab & _
    objSoftware.InstallDate2 & vbtab & _
    objSoftware.InstallLocation & vbtab & _
    objSoftware.InstallState & vbtab & _
    objSoftware.Name & vbtab & _
    objSoftware.PackageCache & vbtab & _
    objSoftware.SKUNumber & vbtab & _
    objSoftware.Vendor & vbtab & _
    objSoftware.Version
Next
objTextFile.Close

1 Spice up

Oh FFS!

Seriously Peter!

If you’re going to add the same answer to a bunch of old questions you might want to have a read of this blog entry first: Why Win32_Product is Bad News! - SDM Software

edit:

Or just create a How-To.

NOTE: Using Win32_Product forces a consistency check of each installation which might lead to excessive CPU utilization. As an alternative, you might want to use Get-RemoteProgram cmdlet ( https://gallery.technet.microsoft.com/scriptcenter/Get-RemoteProgram-Get-list-de9fd2b4 ) with the following syntax (it queries registry to get installed programs information):

Get-RemoteProgram -ComputerName RemoteComputerName

Here is an updated way of how to do it with powershell (query multiple computers, filter, sort, save to CSV):

  1. Get list of installed programs

Thru WMI object:

Get-WmiObject -Class Win32_Product -Computer RemoteComputerName

Thru Get-RemoteProgram cmdlet ( https://gallery.technet.microsoft.com/scriptcenter/Get-RemoteProgram-Get-list-de9fd2b4) :

Get-RemoteProgram -ComputerName RemoteComputerName

  1. Select specific columns:

Get-WmiObject -Class Win32_Product -Computer RemoteComputerName | Select-Object Name, Version

  1. Sort results:

Get-WmiObject -Class Win32_Product -Computer RemoteComputerName | Select-Object Name, Version | Sort-Object Name

  1. Filter results:

Get-WmiObject -Class Win32_Product -Computer RemoteComputerName | Select-Object Name, Version | Where-Object -FilterScript {$_.Name -like “Microsoft*”}

  1. Save to CSV file:

Get-WmiObject -Class Win32_Product -Computer RemoteComputerName | Select-Object Name, Version | Export-CSV “c:\file.csv” -Append -NoTypeInformation

  1. Query multiple computers:

Query computers from a text file:

Get-Content -Path c:\computers.txt | ForEach-Object {Get-WmiObject -Class Win32_Product -Computer $_.Name}

Query computers from AD domain: Get-ADComputer -Filter {OperatingSystem -Like “Windows 10*”} | ForEach-Object {Get-WmiObject -Class Win32_Product -Computer $_.Name}

Source: Script to List Installed Software on Multiple Computers

Or you can use Action1 Endpoint Security Platform - it gives you a lot of info on your endpoints in real-time, including installed software: The Best Risk-based Patch Management | Action1 https://www.action1.com