I'm trying to write a PS script to update the job title for users in AD. I was given a CSV file with a list of users email address and I'm using that.
This is what my CSV file looks like:
"email","jobtitle"
"user@email.com"," A JOB"
This is what my script looks like.
Import-Module ActiveDirectory
Import-CSV -Path "pathtofile.csv" | Foreach-Object {
# properties from the csv
$mail = $.email
$title = $.jobtitle
Get-ADUser -Filter {(mail -eq "$mail")} | Set-ADUser -Title $title
}
After running the scrip, PS does not return feedback and the AD attribute does not update for job title. Anyone know what I'm missing?