![Lead Image © Andrea De Martin, 123RF.com Lead Image © Andrea De Martin, 123RF.com](/var/ezflow_site/storage/images/archive/2019/51/software-inventory-with-powershell/andrea_de_martin_123rf-eye_spy.png/163470-1-eng-US/Andrea_De_Martin_123rf-Eye_Spy.png_medium.png)
Lead Image © Andrea De Martin, 123RF.com
Software inventory with PowerShell
Data Detective
PowerShell provides several ways to access the installed software. Because it supports a variety of interfaces, administrators have freedom of choice in data collection. Depending on the operating system and your own objectives, the method can be different. The access methods can also be combined, and the result sets transferred to the output routines. From database-supported inventory to an HTML report sent by email, many options are available.
Since Windows NT, the Windows Management Instrumentation (WMI) class group has offered administrators an interface pool for hardware, software, infrastructure, and directory services. Two classes are of interest if you need an overview of installed software: the Win32_Product
system library and the Win32Reg_AddRemovePrograms
class. Win32_Product
does not require any additional installed components, and it is available on Windows client and server systems. The following command provides an overview of attributes that can be used for a report:
> Get-WmiObject -class Win32_Product | Get-Member -MemberType Properties ;
If you now take advantage of PowerShell's filtering capabilities, you can create a vendor-specific report. The pipeline can deliver all the installed programs for a specific vendor:
> Get-WmiObject -class Win32_Product | Where-Object -FilterScript {$_.vendor -eq "Microsoft Corporation"} Microsoft System Center Configuration Manager (SCCM, also known as ConfigMgr), formerly Systems Management Server (SMS)
The other WMI class useful for software inventory work is not a system library. Win32Reg_AddRemovePrograms
is only loaded during the installation of a Systems Management Server (SMS)/System Center Configuration Manager (SCCM) client. A query without an SMS/SCCM client installation leads to the Invalid class
error message. If Win32Reg_AddRemovePrograms
is available,
Buy this article as PDF
(incl. VAT)