I have written a script that will update most of the fields that I am looking for, except the Manger field. For the life of me I cannot figure out what I am missing.
Script:
import-module activedirectory
$users = Import-Csv -Path \\<server>\<Folder>\<filename>.csv
foreach ($user in $users) {
$manager = Get-ADUser -Filter "CN -eq '$($users.Manager)'"
Get-ADUser -Filter "DisplayName -eq '$($user.PreferredName)'" -Properties * |
Set-ADUser -employeeID $($user.EMPL_ID) -Company $($user.Location) -Office $($user.Location) -Title $($user.TITLE_DESC) -Department $($user.Department) -Description $($user.TITLE_DESC) -Manager $($manager)
}
It will return no errors, and the other fields will update, however it returns a blank Manger attribute to the AD entry.
The CSV is here:
EMPL_ID,LAST_FIRST_NAME,S_EMPL_STATUS_CD,Manager,Location,PreferredName,TITLE_DESC,Department
3129,"Meehan, Douglas P",ACT,David Yerby,HSAG-AZ,Pete Meehan,Network Administrator 1,Information Technology
I have been combing the technet, spice works and here, but I am still stuck. Please help.