Update Users custom attribut from csv list

Hello,

Would like to know how to update/assign 2 custom attribut in my AD

i have a csv with the header :

username;carLicense;roomNumber

Where the username is the samaccount and the 2 other are the name of the custom attribut that already exist in my AD.

If i run this command Set-ADUser “lemitest” -Replace @{carLicense=“000001127”}

The attribut is set correctly but i am not able to run the command to update 2 attribut at the same time would have to double each line, even if i was able it is not what i am looking for it need to read from a csv as i have about 4000 user to update these attribut.

My knowledge of powershell is way to limited to pull this of by myself… i am trying to work from this script found on google

$users=import-csv D:\users2.csv foreach($user in $users) { Get-ADUser $users| Set-ADUser -Replace @{carLicense=($user.username)} -Verbose } 
3 Spice ups

You should use:

Get-ADUser $user.username | Set-ADUser -Replace @{carLicense=$user.carLicense;roomNumber=$user.roomNumber} -Verbose 

in your foreach loop.

2 Spice ups

The -Replace parameter takes a hash table of property names to be updated and the values to set for each object. SO just extend the hash table as shown above.

1 Spice up