Created
November 12, 2019 07:36
-
-
Save stromvirvel/02cc7ba80a24281f02557a478368bcfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get users with same username part of UPN | |
$users = get-azureaduser -all:$true | |
foreach($user in $users) | |
{ | |
# do we have more users with the same username-part of the UPN? | |
$username = $user.userprincipalname.split("@")[0] | |
if ( ($users | ? {$_.userprincipalname -like "$($username)@*"} | Measure-Object).count -gt 1) | |
{ | |
write-output "$($user.userprincipalname)`t$($user.mailnickname)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment