Starting from ConfigMgr 2012 R2 we can use New-Item PowerShell cmdlet to create ConfigMgr Admin Console folders. Here is one simple and quick PowerShell script that allows you to create folders and Collections and finally it moves the Collection to correct folder.

#Step 1
Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1")
$SiteCode = Get-PSDrive -PSProvider CMSITE
Set-Location "$($SiteCode.Name):\"

#Step 2
New-Item -Name 'OSD' -Path 'PS1:\DeviceCollection'
New-Item -Name 'Mobile Device Management' -Path 'PS1:\DeviceCollection'
New-Item -Name 'Power Management' -Path 'PS1:\DeviceCollection'
New-Item -Name 'ViaMonstra' -Path 'PS1:\DeviceCollection'
New-Item -Name 'Software Updates' -Path 'PS1:\DeviceCollection'
New-Item -Name 'Compliance' -Path 'PS1:\DeviceCollection'

#Step 3
New-CMDeviceCollection -Name 'Test 1' -LimitingCollectionName 'All Systems'
New-CMDeviceCollection -Name 'Test 2' -LimitingCollectionName 'All Systems'
New-CMDeviceCollection -Name 'Test 3' -LimitingCollectionName 'All Systems'
New-CMDeviceCollection -Name 'Test 4' -LimitingCollectionName 'All Systems'
New-CMDeviceCollection -Name 'Test 5' -LimitingCollectionName 'All Systems'

#Step 4
$Collection1 = Get-CMDeviceCollection -Name 'Test 1'
$Collection2 = Get-CMDeviceCollection -Name 'Test 2'
$Collection3 = Get-CMDeviceCollection -Name 'Test 3'
$Collection4 = Get-CMDeviceCollection -Name 'Test 4'
$Collection5 = Get-CMDeviceCollection -Name 'Test 5'

#Step 5
Move-CMObject -InputObject $Collection1 -FolderPath 'PS1:\DeviceCollection\OSD'
Move-CMObject -InputObject $Collection2 -FolderPath 'PS1:\DeviceCollection\Mobile Device Management'
Move-CMObject -InputObject $Collection3 -FolderPath 'PS1:\DeviceCollection\Power Management'
Move-CMObject -InputObject $Collection4 -FolderPath 'PS1:\DeviceCollection\ViaMonstra'
Move-CMObject -InputObject $Collection5 -FolderPath 'PS1:\DeviceCollection\Software Updates'

 

After the script execution you have 6 folders and in each folder Test x Collection – as you see it is really easy to create Collections and Folders with PowerShell.

image

image

 

Best,

Kaido