Link to home
Start Free TrialLog in
Avatar of Roccat
RoccatFlag for United States of America

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\AmigosList.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"
               }
}
SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Roccat

ASKER

Thanks! This was very helpful.