Get CM Containers

SCCM “folders” are WMI objects in disguise.

  ·  2 min read

I may sometimes refer to folders as containers and the items inside of them as nodes. It is important to understand that when you create a folder in SCCM it is not really a folder. What you are actually interacting with is a CM Object. What are CM Objects? You can read the Microsoft documentation here CM Objects. But the best TL:DR I can give is that they are Instances of CM specific WMI classes. So when browsing the PSDrive you created and you run Get-ChildItem ABC:\DeviceCollection it is returning a list of all containers at the root of Device Collections, which are the WMI classes for Device Collections. Take a look at the example output below. Notice that multiple containers are returned (more than I have shown here).

 1PS ABC:\> Get-ChildItem .\DeviceCollection
 2
 3PSPath                : AdminUI.PS.Provider\CMSite::siteserver.contoso.com\DeviceCollection
 4PSParentPath          : AdminUI.PS.Provider\CMSite::siteserver.contoso.com
 5PSChildName           : DeviceCollection
 6PSDrive               : ABC
 7PSProvider            : AdminUI.PS.Provider\CMSite
 8PSIsContainer         : True
 9SmsProviderObjectPath : SMS_ObjectContainerNode.ContainerNodeID=2
10ContainerNodeID       : 2
11FolderFlags           : 0
12FolderGuid            : 8D4A816D-E5B5-44D0-8D3B-ED3BDBE42CDE
13IsEmpty               : False
14Name                  : All Systems
15ObjectType            : 5000
16ObjectTypeName        : SMS_Collection_Device
17ParentContainerNodeID : 0
18SearchFolder          : False
19SearchString          :
20SourceSite            : ABC
21
22PSPath                : AdminUI.PS.Provider\CMSite::siteserver.contoso.com\DeviceCollection
23PSParentPath          : AdminUI.PS.Provider\CMSite::siteserver.contoso.com
24PSChildName           : DeviceCollection
25PSDrive               : ABC
26PSProvider            : AdminUI.PS.Provider\CMSite
27PSIsContainer         : True
28SmsProviderObjectPath : SMS_ObjectContainerNode.ContainerNodeID=40
29ContainerNodeID       : 40
30FolderFlags           : 0
31FolderGuid            : FC17345A-AEED-41F2-ABF0-4B9854DCE19D
32IsEmpty               : False
33Name                  : All Unknown Computers
34ObjectType            : 5000
35ObjectTypeName        : SMS_Collection_Device
36ParentContainerNodeID : 0
37SearchFolder          : False
38SearchString          :
39SourceSite            : ABC

Now lets try running Get-ChildItem ABC:\DeviceCollection\Folder1 and Get-Item ABC:\DeviceCollection\Folder1 notice anything different? We can use Get-Item to just return the parent at that location or Get-ChildItem to return all of its children.

You can use this information to get all containers on the site. Not sure what container types are available? Just ls ABC: and it will return all the container types available to you. Tab complete does work when navigating the drive. However it is very very slow to complete. I recommend you enter in the path instead.

Here is a list of available container types as of writing.

 1PS C:\Users\kassidy> ls ABC:
 2Application
 3BootImage
 4ConfigurationBaseline
 5ConfigurationItem
 6DeviceCollection
 7Driver
 8DriverPackage
 9OperatingSystemImage
10OperatingSystemInstaller
11Package
12Query
13SoftwareMetering
14SoftwareUpdate
15TaskSequence
16UserCollection
17UserStateMigration
18VirtualHardDisk
19SmsProvider