Add/Remove bulk Devices From Collection

Today i am going to show how to Add or Reemove bulk devices from the device Collection.

As a sccm engineer we usually see these scenarios to add and remove bulk devices from the collection depends on the project type.

Add Devices

#add devices to the Collections
Get-Content “C:\import-list.txt” | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionName “Device collection name here..” -ResourceID (Get-CMDevice -Name $_).ResourceID }

Follow same above steps for Removing devices

#Remove devices from collection
Get-Content “C:\remove-list.txt” | foreach { Remove-CMDeviceCollectionDirectMembershipRule -CollectionName “Device collection name here..” -ResourceID (Get-CMDevice -Name $_).ResourceID }

 

 

Exit mobile version