Add Computers to an AD Group from CSV file

We need to prepare the data.csv file with computer names only (do not add any titles at the top)

Then create a ps1 file and add the following script and run. Just make sure you change SCCMClient portion with your own group name.


$laptops = Get-Content "data.csv"


foreach ($laptop in $laptops) {

    $obj = Get-ADComputer $laptop

    Add-ADGroupMember -ID SCCMClients -Members $obj


  • Hits: 2946