Spread the love

This is handy if you have a long list of devices that need to be added to a collection and eliminates the tediousness of adding machines one by one!

Run PowerShell within the SCCM console and run the following command:
Get-Content “c:\temp\server_list.txt” | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionName “Server Software Update Group 1 – Thursday” -ResourceID (Get-CMDevice -Name $_).ResourceID }
Change the parts in BOLD to where ever your server list is and the collection name you want and it will add all the machines to the groups for you. (Also make sure your .txt file is named the same as what is written in the script).