title: How can I update AD users using PowerShell and CSV import?
body: <p>I'm trying to use this powershell script to update AD users.  Ideally I'll be updating a bunch of attributes, but for now I'm just trying to get it to update the department just so I get tell if it's working.  </p>
  
  <pre><code>Import-Module ActiveDirectory  
  
  $dataSource=import-csv "c:\ADupdate.csv"
  foreach($dataRecord in $datasource) {
  $employeeID=$dataRecord.employeeID
  
  # List of attributes to update
  $department=$dataRecord.department
  
  Get-ADUser -SearchBase "ou=Test,ou=OurUsers,ou=Logins,dc=domain,dc=com" -Identity $employeeID -Properties department | Set-ADUser -Replace @{department=$department}
  
  }
  </code></pre>