How can I select only the email address from the UPN variable, so $useremail -eq $ADUPN is true?
PS C:\Windows\system32> $useremail
PS C:\Windows\system32> $useremail -eq $ADUPN
is what is shown when you use
PS C:\Windows\system32> $ADUPN
PS C:\Windows\system32> $useremail -eq $ADUPN.userPrincipalName
By the way, UPN is not an email address, it’s a userPrincipalName, which may or may not be the same as the user;s email address depending on how the environment is setup.
Thanks a lot!
That did the trick. Know its not the same, migrating from Lotus notes to Office 365 and whant to check that emailadress and UPN is the same, if not flag it to Helpdesk in a email.
First I thought it was my logical statement that was wrong, until I checked what $ADUPN outputted.