I'd like to find a PowerShell script that retrieve the SCCM collections for a given computer or user. I know this can be achieve via a SCCM query, but I'd like to do this using a PowerShell function.
The script should work with SCCM 2007 and SCCM 2012.
Best Answer
Here is the PowerShell function to do that :
Simply adapt the value of the $Server and $Site variables according to your environment.
Here are examples of how to use this function :
The result will be a table showing the Collection ID, Collection Name and Comment associated with the computer or the user.
Hope this helps!