i'm trying to update the msExchExtensionAttribute16 in AD and because I have a lot of users, I decided to write a script. however i'm stuck if the below will assign a value to msExchExtensionAttribute16 based on sAMAccountName (csv have employeeID and ipPhone only):
$userlist = import-csv C:\userlist.csv
foreach ($user in userlist)
{
x=get-aduser -LDAPfilter "(sAMAccountName=$user)"
set-aduser msExchExtensionAttribute16=$ipPhone
}I just can't get or don't know how to tell the script that if sAMAccountName is equal to $employeeID then set msExchExtensionAttribute16=$ipPhone ?