Select email address from UPN variable? This topic contains 2 replies, has 2 voices, and was last updated by Alexanxder Holmeset 6 months, 3 weeks ago. Author Posts June 24, 2017 at 4:38 pm #73595 Alexanxder HolmesetParticipant How can I select only the email address from the UPN variable, so $useremail -eq $ADUPN is true? userPrincipalName —————– firstname.lastname@example.org PS C:\Windows\system32> $useremail email@example.com PS C:\Windows\system32> $useremail -eq $ADUPN False June 24, 2017 at 6:01 pm #73598 Curtis SmithParticipant Assuming: userPrincipalName —————– firstname.lastname@example.org is what is shown when you use PS C:\Windows\system32> $ADUPN Then 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. June 24, 2017 at 9:04 pm #73607 Alexanxder HolmesetParticipant 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. Author Posts You must be logged in to reply to this topic.