PowerShell: Get a List of Installed Software from ConfigMgr

Let’s say you’ve got Microsoft’s System Center Configuration Manager (SCCM / ConfigMgr) in your IT environment (and if you don’t, why on earth not!). If you’re on the desktop management team, you might occasionally get requests from someone on a network or security team, inquiring as to the installed software on a particular client, or group of clients.

Rather than diving straight into the ConfigMgr reports, as most people do, sometimes it’s just faster to load a data set into PowerShell and massage the data from there. Why PowerShell? Well, it provides very easy, real-time filtering and sorting capabilities, and if you need to make a modification to a temporary “report,” you don’t have to worry about modifying the Report object in the ConfigMgr provider, which is typically done through the ConfigMgr console.

Here is a quick, single-line script I threw together yesterday, in less than 5 minutes, to retrieve an alphabetically-sorted list of software installed on a particular client. All you need to do is replace the:

  • SCCM Server name (-ComputerName)
  • WMI Namespace (-Namespace)
  • Client computer name (“testclient”)

[cc lang=”powershell”]
Get-WmiObject -ComputerName sccm01 `
-Namespace root\sms\site_lab `
-Query (“select ArpDisplayName from SMS_R_System join SMS_G_SYSTEM_Installed_Software ” + `
“on SMS_R_System.ResourceID = SMS_G_SYSTEM_Installed_Software.ResourceID ” + `
“where SMS_R_System.Name = ‘testclient'”) `
| Select-Object ARPDisplayName | Sort-Object ARPDisplayName
[/cc]