Create an SCCM collection with Powershell WMI

Create an SCCM collection with Powershell WMI

Automation is the keyword to get rid of repetitive tasks – then you can focus on the real work right?

So here we go again, this time to create a User Collection with the SMS_Collection WMI class.
I only used this function to create user collections, but can easily be modified to create device collections. Link to the WMI class in the bottom.

Also this function uses the log function which you can find here: here

As the same as in other scripts I have defined two global variables in top of the script so it’s not needed to declare server and site when calling the function later on:

Here you go:

Below i create a collection in the root folder of the user collections named ‘All female users’:

Read the whole Microsoft article about the SMS_Collection class here

There it is guys, feel free to leave a comment.

Leave a comment