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