PowerShell add Computers to Collection from CSV – SCCM ConfigMgr

This is a quick and dirty PowerShell script to import from CSV using the name of the machine to find the resource ID. It will only work for machines that are already a member of the Site you are working on.

For example you could use one of my other scripts to export from one collection and then add to a new collection.

As always this is provided as is, usage is in the header and please use the modded by field 😉

One Reply to “PowerShell add Computers to Collection from CSV – SCCM ConfigMgr”

  1. Create a file “sccc.txt” contain the list of pcs/devices name
    Click on properties of device collection and copy the collection Id
    Open power shell from SCCM
    Run the command “Get-Content “C:\Users\altaf\Desktop\sccm.txt” | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionId PKISB0015B -ResourceID (Get-CMDevice -Name $_).ResourceID }”
    Now check you collection
    for details check

    https://gallery.technet.microsoft.com/Multiple-Computers-to-a-fdc35ffa

Leave a Reply

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

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.