Lead Image © Andrea De Martin, 123RF.com

Lead Image © Andrea De Martin, 123RF.com

Software inventory with PowerShell

Data Detective

Article from ADMIN 51/2019
By
PowerShell easily combines different interfaces for querying or reporting data.

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,

...
Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus