Adding Devices To A Collection Using PowerShell


I get requested far too often to add devices to collections. Sometimes it’s 1 machine and sometimes it’s a 100 machines. I got tired of opening the SCCM/ConfigMgr console every time I received these requests.

So I thought, why not create a PowerShell script which does this for me without having to open the SCCM/ConfigMgr Console.

How to run the script

There are 4 parameters available for this script…

  • MultiAdd
    • Required: No
    • Inputs: Yes/No
    • Usage: Use this when adding multiple devices. Device names must be saved in a text file.
  • CollectionName
    • Required: No
    • Inputs: Collection Name
    • Usage: Use this when specifying the Collection Name. If parameter is not specific, you will be prompted with a list of collections from your environment to pick.
  • Computer
    • Required: No
    • Inputs: Computer Name
    • Usage: Use this when sepcifying a single device to add. If paramater is not specific, you will be prompted to enter Computer Name.
  • FilePath
    • Required: No
    • Inputs: Path to txt file
    • Usage: Specify the file path of the text file with device names. If not specified, you will be prompoted to browse and select the text file.


  1. Add computers from text file to a collection.
    Add-DeviceToCollection -FilePath C:\temp\sample.txt -CollectionName 'Amar - test'
  2. Add computer PC01 to a collection (prompt to select collection)
    Add-DeviceToCollection -Computer PC01

The Script



Leave a Reply

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