after finding the correct syntax,
$employeeID=60001
if (Get-ADuser -LDAPfilter "(sAMAccountName=$employeeID)") {
echo "found it!"
Set-ADuser -Identity $employeeID -Add @{msExchExtensionAttribute16=3000}
}now i'm trying to read a CSV file and loop over the above code for bulk modifications:
$userlist = Import-CSV C:\users3.csv
foreach ($person in $userlist) {
echo $person.employeeID
if (Get-ADuser -LDAPfilter "(sAMAccountName=$person.employeeID)") {
echo "found it!"
else
echo "skipped!"
}
}the statement "echo $person.employeeID" works but the conditional doesn't seem to be doing anything. it won't do either of the echo command given.
how do you do a trace in powershell?