Using Powershell you can do many things in SCCM. Over the years, in many SCCM consulting projects we got involved in, we get the same question: “Can you create SCCM collections for Servers, Laptops, Workstations, Windows 10…”. Back in 2015, I started to build an SCCM collection PowerShell script to create SCCM operational collections which we create just after an SCCM installation. With time, I added more and more collections to the script. Fast forward to today, the script now contains 148 collections and has been downloaded more than 75 000 times making this PowerShell script my most downloaded contribution to the community.
This set of collections usually covers 95% of the initial client needs. All you need to do is to run the SCCM collection PowerShell script on your SCCM server and wait. In about 5 minutes, you’ll end up having 148 collections in an Operational folder.
The collections are set to refresh on a 7 days schedule. Once created, you can use these collections to have a quick overview of your devices. You can also use these collections to create deployment collections by using limiting collections on these ones.
The script uses the New-CMDeviceCollection and Add-CMDeviceCollectionQueryMembershipRule cmdlet.
Full collections list created by the script
Features :
- Handle collections that was created by a previous version of the script
- The collections will be placed in an “Operational” folder
- The collections are set to 7 day refresh period
Here’s the full SCCM collection that the script Powershell creates:
- All Clients
- All Clients Active
- All Client Inactive
- All Clients Online
- 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 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 Not Latest
- All Client 1511
- All Client 1602
- All Client 1606
- All Client 1610
- All Client 1702
- All Client 1706
- All Client 1710
- All Client 1802
- All Client 1806
- All Client 1810
- All Client 1902
- All Client 1906
- All Client 1910
- All Client 2002
- All Client 2006
- All Client 2010
- All Client 2103
- All Client 2107
- All Client 2111
- All Client 2203
- All Client 2207
- All Clients Not Reporting HW Inv since 14 days
- All Clients Not Reporting SW Inv since 30 days
- All Clients X86
- All Clients X64
- All Laptops
- All HP Laptops
- All Lenovo Laptops
- All Dell 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 Servers Windows 2016
- All Servers Windows 2019
- 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 Workstations Windows 10
- All Workstations Windows 11
- 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 Phone 10
- Mobile Devices – All Windows Phone 8
- Mobile Devices – All Windows Phone 8.1
- Mobile Devices – All Microsoft Surface
- Mobile Devices – All Microsoft Surface 3
- Mobile Devices – All Microsoft Surface 4
- Mobile Device – All
- Workstations | Windows 10 v1507
- Workstations | Windows 10 v1511
- Workstations | Windows 10 v1607
- Workstations | Windows 10 v1703
- Workstations | Windows 10 v1709
- Workstations | Windows 10 v1803
- Workstations | Windows 10 v1809
- Workstations | Windows 10 v1903
- Workstations | Windows 10 v1909
- Workstations | Windows 10 v2004
- Workstations | Windows 10 v20H2
- Workstations | Windows 10 v21H1
- Workstations | Windows 10 v21H2
- Workstations | Windows 11
- Workstations | Windows 11 v21H2
- Workstations | Windows 10 Current Branch (CB)
- Workstations | Windows 10 Current Branch for Business (CBB)
- Workstations | Windows 10 Long Term Servicing Branch (LTSB)
- Workstations | Windows 10 Support State – Current
- Workstations | Windows 10 Support State – Expired Soon
- Workstations | Windows 10 Support State – Expired
- Others | Linux Devices
- Others | MAC OSX Devices
- Office 365 Build Version | 1705
- Office 365 Build Version | 1709
- Office 365 Build Version | 1802
- Office 365 Build Version | 1803
- Office 365 Build Version | 1808
- Office 365 Build Version | 1902
- Office 365 Build Version | 1908
- Office 365 Build Version | 1912
- Office 365 Build Version | 2001
- Office 365 Build Version | 2002
- Office 365 Build Version | 2003
- Office 365 Build Version | 2004
- Office 365 Build Version | 2005
- Office 365 Build Version | 2006
- Office 365 Build Version | 2007
- Office 365 Build Version | 2008
- Office 365 Build Version | 2009
- Office 365 Build Version | 2010
- Office 365 Build Version | 2011
- Office 365 Build Version | 2012
- Office 365 Build Version | 2101
- Office 365 Build Version | 2102
- Office 365 Build Version | 2103
- Office 365 Build Version | 2104
- Office 365 Build Version | 2105
- Office 365 Build Version | 2106
- Office 365 Build Version | 2107
- Office 365 Build Version | 2108
- Office 365 Build Version | 2109
- Office 365 Build Version | 2110
- Office 365 Channel | Monthly
- Office 365 Channel | Monthly (Targeted)
- Office 365 Channel | Semi-Annual
- Office 365 Channel | Semi-Annual (Targeted)
- All systems having a duplicate device record
- Workstations | Co-Management Enabled
- Workstations | Defender ATP Onboarded
- Workstations | Defender ATP Not Onboarded
SCCM collection PowerShell script Note
The script will detect if the collection has already been created. It will give a warning and create only new collections that have been added since the last time the script is run.
If you are comfortable with editing scripts, you can comment out any unwanted collections using (#) at each line of the section.
Ex:
#$Collections +=
#$DummyObject |
#Select-Object @{L=”Name”
#; E={“Clients Version | R2 CU5″}},@{L=”Query”
#; E={“select #SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifie#r,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System
#where SMS_R_System.ClientVersion = ‘5.00.7958.1604’”}},@{L=”LimitingCollection”
#; E={$LimitingCollection}},@{L=”Comment”
#; E={“All systems with SCCM client version R2 CU5 installed”}}
#New-CMDeviceCollection -Name $Collection1.Name -LimitingCollectionName $LimitingCollection -RefreshSchedule $Schedule -RefreshType 2
#Add-CMDeviceCollectionQueryMembershipRule -CollectionName $Collection1.Name -QueryExpression $Collection1.Query -RuleName $Collection1.Name
Download the SCCM collection PowerShell script
The SCCM collection PowerShell script can be downloaded from my GitHub repo.
Extra hint: You can also verify if your collection has been created properly in your collections with our Configuration Manager – Collections report. Simply sort the report by the Operational folder name
ChangeLog
# Version : 3.6
# Created : 2014/07/17
# Modified :
# 2014/08/14 - Added Collection 34,35,36
# 2014/09/23 - Changed collection 4 to CU3 instead of CU2
# 2015/01/30 - Improve Android collection
# 2015/02/03 - Changed collection 4 to CU4 instead of CU3
# 2015/05/06 - Changed collection 4 to CU5 instead of CU4
# 2015/05/06 - Changed collection 4 to SP1 instead of CU5
# - Add collections 37 to 42
# 2015/08/04 - Add collection 43,44
# - Changed collection 4 to SP1 CU1 instead of SP1
# 2015/08/06 - Change collection 22 query
# 2015/08/12 - Added Windows 10 - Collection 45
# 2015/11/10 - Changed collection 4 to SP1 CU2 instead of CU1, Add collection 46
# 2015/12/04 - Changed collection 4 to SCCM 1511 instead of CU2, Add collection 47
# 2016/02/16 - Add collection 48 and 49. Complete Revamp of Collections naming. Comment added on all collections
# 2016/03/03 - Add collection 51
# 2016/03/14 - Add collection 52
# 2016/03/15 - Added Error handling and better output
# 2016/08/08 - Add collection 53-56. Modification to collection 4,31,32,33
# 2016/09/14 - Add collection 57
# 2016/10/03 - Add collection 58 to 63
# 2016/10/14 - Add collection 64 to 67
# 2016/10/28 - Bug fixes and updated collection 50
# 2016/11/18 - Add collection 68
# 2017/02/03 - Corrected collection 39 and 68
# 2017/03/27 - Add collection 69,70,71
# 2017/08/25 - Add collection 72
# 2017/11/21 - Add collection 73
# 2018/02/12 - Add collection 74-76. Changed "=" instead of like for OS Build Collections
# 2018/03/27 - Add collection 77-81. Corrected Collection 75,76 to limit to Workstations only. Collection 73 updated to include 1710 Hotfix
# 2018/07/04 - Version 3.0
# - Add Collection 82-87
# - Optimized script to run with objects, extended options for replacing existing collections, and collection folder creation when not on site server.
# 2018/08/01 - Add Collection 88
# 2019/04/04 - Add Collection 89-91
# 2019/09/17 - Add Collection 92-94, Windows 2019, Updated Windows 2016
# 2020/01/09 - Add Collection 95-100
# 2021/11/22 - Add Collection 100-133
# 2022/08/24 - Add Collection 133-148
#
#############################################################################
If you want to add a collection to the list, feel free to contact me using our social media or use the comment section. It will be our pleasure to add it to the next version.
Ahmed Essam
02.27.2024 AT 04:52 AMfedeSCCM
07.16.2020 AT 04:31 AMBenoit Lecours
08.24.2022 AT 08:13 AMsoner
05.30.2019 AT 07:36 AMAsus Technical Support
09.04.2018 AT 06:42 AMace
04.28.2017 AT 03:48 AMGregoryB
04.26.2017 AT 09:44 PMShakti
04.24.2017 AT 04:07 AMJesse
03.21.2017 AT 09:53 AMJesse
03.21.2017 AT 10:19 AMChad Simmons
01.19.2017 AT 11:56 AMKeith
12.27.2016 AT 02:13 PMChris
01.04.2017 AT 01:02 PMfotios
09.14.2016 AT 01:39 PMBrachus
01.21.2016 AT 09:06 AMBenoit Lecours
01.22.2016 AT 09:02 AMSteve
11.04.2015 AT 09:57 AMBenoit Lecours
11.04.2015 AT 05:07 PMAndre van den Berg
08.19.2015 AT 06:03 AMMartin
12.07.2015 AT 09:00 AMAaron Whittaker
08.12.2015 AT 03:41 AMBenoit Lecours
08.12.2015 AT 08:00 AMChad Simmons
11.20.2015 AT 01:56 PMLeif
01.16.2015 AT 11:44 AMMario
12.07.2014 AT 09:43 AMMario
12.07.2014 AT 09:35 AMhttp://www.generatefreegold.win/
02.28.2017 AT 12:12 PM