locked
Select only numerical UPN value from Active Directory RRS feed

  • Question

  • I'm writing a script to select Active Directory UserPrincipalName by email address.  However, I want to output only the UPN with the numerical value NOT the alphabetical value.

    Get-ADUser -Filter {EmailAddress -eq "john.doe@powershell.com"} -Properties UserPrincipalName,EmailAddress |
    Select-Object UserPrincipalName,EmailAddress

    This command will return multiple UPN's associated with that email address (different levels of access).  For example:
    3045478213@powershell.com
    admin-john.doe@powershell.com
    john.doe@powershell.com

    How can I select ONLY the 3045478213@powershell.com object? Thanks!

    Thursday, March 22, 2018 4:03 PM

All replies