Get Direct Collection Memberships And Machine Variables Information

On several occasions I have had the need to pull information on SCCM devices, and recently I was asked to do a backup of all client direct memberships and some specific machine variables.

So I thought I would share my latest version of a script that does that.

The script takes an argument that will allow you to limit the process to only a set of named clients or just one if you prefer.

The script starts by create a class to contain the information pulled from SCCM, making it easier to work with afterwards.

Next the script will pull the list of client to process

Now we get to the good bits, a loop will run through the list of clients and build an object of type SCCMResource

Lets get the machine variables for the resource and add the result to the object

And then the direct memberships using a very loooong WMI query

Finally stuff the object into the result array

Now we have an array containing objects with information on the client, and we can use it for all sorts of funny stuff, if you pipe $result through Out-GridView you get something like this.

image

You can download the full script from this link

And finally I’d like to wish you a happy christmas and maybe this little gem will you into the right mood for the holidays.

By | 2014-12-10T00:02:00+00:00 December 10th, 2014|Configuration Manager (SCCM), General info, Powershell|0 Comments

About the Author:

Ronnie Jakobsen

Twitter: @RonnieJakobsen

Leave A Comment