Recently at our PowerShell Bangalore User group, we had fun participating in a one day PowerShell + ConfigMgr Hackathon event. Where we had a bunch of ConfigMgr admins worked on using Azure to deploy a full fledged ConfigMgr Lab, also we had fun interacting with each other.
Below pic was the theme for the event, says it all ;)
My friend Harjit suggested few ideas for the Hackathon. Below is one of the ideas:
"Script that can tell me which collections a particular system or several Systems belong to"
The Final Script is available @Technet for Download
Credits - There is a post by MVP David O'Brien (link in Resource section) which served as a base for my function. The final Function does the following :
If you want the Collection Membership (Name & CollectionID ) of the User Resource then invoke the function like below:
Below is the GIF showing the above in action :
How to find ConfigMgr Collection Membership of client using PowerShell
http://www.david-obrien.net/2014/01/find-configmgr-collection-membership-client-via-powershell/
How to enumerate members of a collection
https://msdn.microsoft.com/en-us/library/hh949334.aspx
Below pic was the theme for the event, says it all ;)
My friend Harjit suggested few ideas for the Hackathon. Below is one of the ideas:
"Script that can tell me which collections a particular system or several Systems belong to"
The Final Script is available @Technet for Download
Credits - There is a post by MVP David O'Brien (link in Resource section) which served as a base for my function. The final Function does the following :
- Fetches the Collection the Resource (Device/User) is member of.
- Uses WQL Queries to enhance the performance.
- For the User resource type, it does a WildCard search .
Usage :
After dot sourcing the Script, you can invoke the Function to either get the information about a Device or User.
Get-ResourceCollectionMemberhip -Name dexterposh -ComputerName dexsccm -ResourceType User Name ResourceType CollectionName CollectionID ---- ------------ -------------- ------------ dexterposh User TestUserCollection DEX00032 dexterposh User All Users SMS00002 dexterposh User All Users and User Groups SMS00004
If you want the Collection Membership (Name & CollectionID ) of the User Resource then invoke the function like below:
Get-ResourceCollectionMemberhip -Name dexchef -ComputerName dexsccm Name ResourceType CollectionName CollectionID ---- ------------ -------------- ------------ dexchef Device Server2012 DEX00038 dexchef Device Server2008 DEX00039 dexchef Device All Systems SMS00001 dexchef Device All Desktop and Server Clients SMSDM003
Below is the GIF showing the above in action :
Resources :
How to find ConfigMgr Collection Membership of client using PowerShell
http://www.david-obrien.net/2014/01/find-configmgr-collection-membership-client-via-powershell/
How to enumerate members of a collection
https://msdn.microsoft.com/en-us/library/hh949334.aspx