Create ConfigMgr 2012 R2 Collections with Powershell

I know we have migrations tools and other built-in options when we want to build a new ConfigMgr environment. But Microsoft have given us Powershell, and there are some really cool cmdlets that we can utilize.

I’ve had a couple of examples lately where i had to create 100+ collections from scratch – or basicly from just a list of applications… And instead of doing that by hand i would much rather do it with Powershell, and save my poor fingers alot of clicking and typing.

Microsoft have a Technet site where all ConfigMgr 2012 R2 cmdlets are listed and described – http://technet.microsoft.com/en-us/library/jj821831(v=sc.20).aspx

Based on all the info from that Microsoft website i did the following:

1 – Collections need Update Schedules, so i went ahead and defined them to begin with.

2 – Defined my Device Collections to be created.

3 – Defined a Query Rule for my Device Collections.

4 – Defined my User Collections to be created.

5 – Defined a Query Rule for my User Collections.

Note: If you want incremental updating enabled on the Collections you can set the –RefreshType to Both instead of Periodic

Now there might be some Powershell guru out there saying – pfft i can do that much better by creating some automation and check’s and UI maybe even. But for normal beings like me this might be helpfull to a some.

So feel free to grab the code and save some time.

– ConfigMgr is my high!

Get the Powershell file from my Skydrive: https://skydrive.live.com/redir?resid=9F84E3E619840C84%215704

By | 2014-02-18T14:07:36+00:00 February 18th, 2014|Configuration Manager (SCCM), Powershell|2 Comments

About the Author:

Henrik Hoe
ConfigMgr specialist that started many years ago with SMS 2003 and been with the product/concept ever since. (Fanatical some would say - i can only agree) Experienced with large customer environments and architecture.MCPMCTS: ConfigMgr 2012MCSA: Windows Server 2012MCT

2 Comments

  1. Chris September 17, 2015 at 0:40 - Reply

    Thanks a lot!

  2. Tomas November 2, 2015 at 15:14 - Reply

    thx Henrik, nice & easy 🙂

Leave A Comment