$CSV = Import-Csv -Delimiter "," -Header username,Phone -Path "C:\Tempo\info.csv"
foreach ($username in $CSV) {
$Temp = "$username.Phone"
Set-ADuser -Identity $username.Username -Add @{extensionAttribute4="$Temp"}
}
With the CSV file looking like this (one row)
Jakob.User, 6789
When running above Code it adds the following value to the AD object:
@{username=Jakob.User; Phone=6789}.Phone
Instead of what I except, which would be 6789.
Is it something in my code or is more of a "serverfault" (or just how it is excepted to run?)
But if i modify the code so it is Add @{extensionAttribute4="aFineExample"}
and then go look at the value, it only adds what i except it to add.