Skip to content

Instantly share code, notes, and snippets.

@ebibibi
Created August 24, 2015 05:30
Show Gist options
  • Select an option

  • Save ebibibi/16dbd44cd27ea7e0c0be to your computer and use it in GitHub Desktop.

Select an option

Save ebibibi/16dbd44cd27ea7e0c0be to your computer and use it in GitHub Desktop.
$users = Get-ADUser -Filter * -Properties displayNamePrintable, DisplayName, mail
$displayNamePrintables = $users.displayNamePrintable
$duplicateUsers = $displayNamePrintables | Where-Object {if(($displayNamePrintables -eq $_).count -ge 2){$_}} | Sort-Object | Get-Unique
Write-Output "表示名 `t DisplayNamePrintable `t メールアドレス"
foreach($user in $users)
{
$duplicateUsers | ForEach-Object {
if($user.displayNamePrintable -eq $_)
{
Write-Output ($user.displayName + "`t" + $user.displayNamePrintable + "`t" + $user.mail)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment