In order to find information from our environment,very often we go out query the information directly at the source, on the network. We will query 100 hundreds of computers to gather information on a specific subject, and use it with conditional logic  to accomplish our daily tasks. If you Configuration Manager deployed in your infrastructure, and need to retrieve some information on your devices, before writing a script that would query all of your devices through WMI remotely, ask your self if you do not have that information already present in your ConfigMgr DataBase.

Everything that is returned through the Hardware and Software inventory is actually present in the Configuration Manager Database, and is out there waiting for you!

How to get information from the configuration manager inventory using PowerShell?

In My case, one of my tasks was to identify the all current Local Admins of all of the computers currently deployed. This task can be done in several ways, such as per script, querying WMI for example. But I had been decided that we would use the ConfigMgr Hardware inventory information that is pulled during the different hardware inventory cycles. For that, we first needed to extend the hardware inventory (Which can be done in seconds!).

This article is more on how to find your way through this more then a step by step, but if you want to follow along, you will need to extend your Hardware inventory by following this post on technet –>


Now the difficult part, is not actually not really how to extend the Hardware inventory, but more where do we actually get that information exactly from once it has been reported back?

If you are interested in seeing a step by step on how to extend your hardware inventory, I recommend you take a look at the following post that was part of ConfigMgr inventory series that I wrote –> How to extend Configuration Manager Hardware inventory Step by Step

As usual, WMI is my preferred the solution. But the main question I had, is where exactly in WMI? This WMI class that I just added cannot be documented on Technet. Where do I go to query the information that it contains? And what is that WMI queries name?

Look in the Configuration Manager inventory / Database after extending the hardware inventory:

Once we have extended the hardware inventory, we go ahead, and take a peek in the Configuration Manager database. If you are not in a hurry, wait until the next day. Like you are sure you have some data in it.

If you open SQL management studio, and naviagate to the following path:DatabasesCM_<SiteName>Views

you can scroll aaaaaall the way down to find dbo_.v_GS_LocalAdmins

That view will contain all the information that has been inventoried by your Configuration Manager Agents.

Configuration Manager Hardware inventory extension Database view

Configuration Manager Hardware inventory extension Database view

Now now knowing that the Database view name is V_GS_LocalAdmins I searched for something similar in the WMI repository. And after a moment, I got it!

PowerShell cconfiguration manager ustom WMI class location

Custom WMI class location

The WMI Class that has been created on the Configuration Manager Site server is named: SMS_G_System_LocalAdmins  and can be found in the RootSMSSite_<SiteName> Namespace.

Now that we have that information, it becomes a piece of cake to get the Local administrator group members from the configuration manager inventory with powershell.

Querying WMI to read data from configuration manager inventory database:

I finally ended up with the following function will help you get the list of all of the local admins per machine:


Remember, by extending the hardware inventory, we actually avoid our self’s to write a script that would go through all of the computers, connect to it, retrieve information, and store it somewhere in a DB. This is something we delegated to Configuration Manager, and he does it well.


Digg more into it: