Multiple Computers to a Single Collection through powershell

Multiple Computers to a Single CollectionCreate 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

3.7 Star
600 times
Add to favorites
System Center
E-mail Twitter Digg Facebook
  • Resource ID is null
    3 Posts | Last post August 17, 2019
    • Hi,
      I am getting this error below when I run the script:
      FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed 
      I am not sure why the Resource ID is null. :( Thanks in advance.
    • Try this:
      $computers = Get-Content "C:\Users\altaf\Desktop\sccm.txt"
      foreach ($computer in $computers) { Add-CMDeviceCollectionDirectMembershipRule -CollectionId PKISB0015B -ResourceID (Get-CMDevice -Name $computer).ResourceID }"
    • Hello, it still did not work for me. Shows as complete but nothing gets added to the collection. 
  • thanks
    1 Posts | Last post October 21, 2018