PowerShell Script Create Operational SCCM collections
In each SCCM project that I get involved, I get the same question : “Can you create a collection for Servers, Laptops, Workstation, Windows 7, Windows 8, ect…”
With time I built a set of “Default” query for device collections that I create right after the initial SCCM setup.
This set of collection usually covers 95% of the initial client needs. I’ve built a PowerShell script so the effort to create 56 collections is near to none.
By running the Powershell script, you’ll end up having 56 collections in a Operational folder. The collections are set to refresh on a 7 days schedule.
Full collections list
- All Clients
- All Clients Active
- All Client Inactive
- All Clients R2 CU0
- All Clients R2 CU1
- All Clients R2 CU2
- All Clients R2 CU3
- All Clients R2 CU4
- All Clients R2 CU5
- All Clients R2 SP1
- All Clients R2 SP1 CU1
- All Clients R2 SP1 CU2
- All Clients R2 SP1 CU3
- All Clients 1511
- All Clients Not Reporting HW since 14 days
- All Clients X86
- All Clients X64
- All Clients not Latest
- All Laptops
- All Dell Laptops
- All HP Laptops
- All Lenovo Laptops
- All SCCM Distribution Points
- All SCCM Site Servers
- All SCCM Site Systems
- All Servers
- All Servers Physical
- All Servers Virtual
- All Servers Windows 2003 or 2003 R2
- All Servers Windows 2008 or 2008 R2
- All Servers Windows 2012 or 2012 R2
- All Systems Created Since 24h
- All Systems Disabled
- All Systems Non Client
- All Systems Obsolete
- All Systems with SCCM Console
- All Workstations
- All Workstations Windows 7
- All Workstations Windows 8
- All Workstations Windows 8.1
- All Workstation Windows 10
- All Workstations Windows XP
- All Windows Update Agent Version Outdated
- Mobile Devices – All Android
- Mobile Devices – All Ipad
- Mobile Devices – All Iphone
- Mobile Devices – All Windows RT
- Mobile Devices – All Windows 8
- Mobile Devices – All Windows 8.1
Note : The collection name must be unique in SCCM so if you already have a collection with the same name, the script will give an error on this particular collection but will continue to process other collections.
Tip : You can comment out any collections that you don’t want using (#) at the begging of the “New/Add-CMCollection” lines in the “Create Collection” Section.
#New-CMDeviceCollection -Name $Collection1.Name -LimitingCollectionName $LimitingCollection -RefreshSchedule $Schedule -RefreshType 2
#Add-CMDeviceCollectionQueryMembershipRule -CollectionName $Collection1.Name -QueryExpression $Collection1.Query -RuleName $Collection1.Name
The script can be downloaded from my GitHub.
Be sure to rate the submission is you are using it. Thanks !
Extra hint : You can also verify if your collection has been created properly in your collections with our Configuration Manager – Collections report
Simply sort by the Operational folder name
***Update 2016-08-08 – Addition of 6 new collections.
***Update 2016-02-16 – Complete revamp of all the collections names and addition of 3 new collections.
***Update 2015-08-12 – Collections updated for R2 SP1, CU1 client versions and Windows 10 (4 new collections)
***Update 2015-05-15 – Collections updated for SP1 and all CU client versions (5 new collections)
***Update 2015-02-02 – Collection #4 updated for Cu4
Founder of System Center Dudes. Based in Montreal, Canada, Senior Microsoft SCCM Consultant, 5 times Enterprise Mobility MVP. Working in the industry since 1999. His specialization is designing, deploying and configuring SCCM, mass deployment of Windows operating systems, Office 365 and Intunes deployments.