Last active
June 8, 2016 05:53
-
-
Save arieljannai/2d10ef5f6077c4b8828aa129480822e1 to your computer and use it in GitHub Desktop.
Find users where their email does not match their usernames
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
# Unmatch | |
Get-ADUser -filter * -Properties SamAccountName, DisplayName, EmailAddress | select SamAccountName, DisplayName, EmailAddress | Where-Object {-not ($_.EmailAddress -like $_.SamAccountName + 'REPLACE_WITH_@COMPANY.COM')} | |
# Match | |
Get-ADUser -filter * -Properties SamAccountName, DisplayName, EmailAddress | select SamAccountName, DisplayName, EmailAddress | Where-Object {$_.EmailAddress -like $_.SamAccountName + 'REPLACE_WITH_@COMPANY.COM'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment