web analytics

Blog

The EASY WAY – List objects in specific folder in Configuration Manager 2012 with PowerShell

Posted by:

Last week I saw one blog post how to list specific folder objects and I believe that actually there is much easier way to list the objects in specific folder. First we need to figure out the ContainerNodeID which is the folder unique ID.

We have several ways to find out the folder unique ID, for example we can run the ConfigMgr Admin console in developer mode or we can use a WMI tool. There are different WMI tools that you can find from the internet or you can simple use the WBEMTEST tool also which is already built-in in Windows. In this case I´m using our Coretech WMI and PowerShell Explorer tool.

So let’s assume that you want to modify collections in OSD folder. In this case I have two collections in OSD folder.

clip_image001

clip_image002

1. Run the Coretech WMI and PowerShell Explorer tool and connect to ROOT\SMS\Site_PS1 namespace.

2. Type into Filter textbox ObjectCon and select SMS_ObjectContainerNode WMI class

clip_image003

3. Select Query tab and execute the following WQL query:

clip_image004

In this output you should see the folder name and the unique ID (ContainerNodeID). Object type 5000 means a Device Collection. You can check additional values from here. Write down the ContainerNodeID property value and then open PowerShell ISE.

4. Write the following code

5. Execute the code and it should list all the Collection Names in OSD folder.

clip_image005

As you see you can query the folder objects only with one query and no need for multiple queries.



About the Author:

Kaido Järvemets is a developer, consultant, trainer specializing in Microsoft System Center Configuration Manager and PowerShell Solutions at Coretech. Kaido frequently speaks at European conferences and had his US debut as speaker at MMS April 2013. Kaido is well-known in the Configuration Manager communities where he’s a key player in the PowerShell game. Kaido host one of the most complete Configuration Manager PowerShell library’s in the world with hundreds of free code samples ready to download and implement – www.cm12sdk.net. Kaido has been awarded Microsoft Most Valuable Professional (MVP) in Microsoft Enterprise Client Management for his work with Configuration Manager from 2011 – to present. Kaido is the founder of System Center User Group Estonia in 2011.

Add a Comment