PowerShell: Add Computers to SCCM Collection

PowerShell: Add Computers to SCCM Collection

For various reasons for example – Client OS deployment, Application Deployment match Organization OU structure with SCCM Device Collection or for any short team need for adding computer to Collection using Direct Membership method.

Below is the PowerShell command to read the computer names from text file and then add those computers to SCCM collection:

Text File – C:SCCMComputers.txt :




Collection Name: “Abobe Photoshop”

$Computers = Get-Content C:SCCMComputers.txtforeach ($computer in $Computers) {Add-CMDeviceCollectionDirectMembershipRule -CollectionName "Adobe Photoshop" -ResourceID $(Get-CMDevice -Name $_.computer).ResourceID}



About The Author

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *