Roccat
asked on
compare email address
Can you help me with this if statement. It should check to see if the ad users email address is equal to the email address imported from the csv.
Import-Csv "C:\Scripts\accounts\Amigo sList.csv" | ForEach-Object {
$SID = $_.STD_ID_LOCAL
$User1 = Get-Aduser -Filter "SamAccountName -eq $SID" -Property SamAccountName
if($User1.EmailAddress -eq $_.Email1){
write-host "Email is already correct"
}
else{
write-host "fix the email"
}
}
Import-Csv "C:\Scripts\accounts\Amigo
$SID = $_.STD_ID_LOCAL
$User1 = Get-Aduser -Filter "SamAccountName -eq $SID" -Property SamAccountName
if($User1.EmailAddress -eq $_.Email1){
write-host "Email is already correct"
}
else{
write-host "fix the email"
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER