Trevor Sullivan's Tech Room

Minding the gap between administration and development

PowerShell: Get a List of Installed Software from ConfigMgr

Posted by Trevor Sullivan on 2011/12/07

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”)
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

One Response to “PowerShell: Get a List of Installed Software from ConfigMgr”

  1. Kaan said

    How can i get the logon users name with this reports? Thanks

    SCCM Server name (-ComputerName)
    WMI Namespace (-Namespace)
    Client computer name (“testclient”)
    Client logon username ( ??????? )

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: