Update AD users from CSV

By | November 15, 2018

Create a CSV file with relevant data i.e.

sAMAccountName,postalCode,givenName,sn
user.name,444444,user,name

Then import and run piping results to a csv.  Adapt the CSV and Set-AdUser sections to do what job you need.

$data = Import-CSV -Path .\data.csv
$data | ForEach-Object {
$user = Get-ADUser -Filter “sAMAccountName -like ‘*$($_.sAMAccountName)*'” -Properties st,postalCode
Set-ADUser -identity $user.sAMAccountName -PostalCode $_.postalCode } | Export-CSV .\results.csv -NoTypeInformation