title: Adding multiple users to groups in AD
body: <p>I have a CSV file which has a list of users and groups they belong to. I am trying to script the same to automate it using PowerShell but seem to be facing an error. When I try to debug it I see that for some reason the user name value is being blank. </p>
  
  <p>Any assistance will be helpful.</p>
  
  <pre><code>$Users = import-csv -Path "C:\Scripts\listofusers.csv" 
  
  foreach-Object ($User in $Users)
  {
      $SAM = $User.'SAM'
      $group = $User.'Group'
  
      Add-ADGroupMember -Identity $group -Members "$SAM"
  }
  </code></pre>
  
  <p>Test Data</p>
  
  <pre><code>Group                  SAM
  
  IT                     Test1   
  Engineering            Test3 
  </code></pre>