List users with UPN’s that don’t match their email address.
1 2 |
Get-ADUser -Filter * -SearchBase 'OU=Staff,DC=domain,DC=local' -Properties EmailAddress | where { ($_.UserPrincipalName -ne $_.EmailAddress) -and ($_.Enabled -ne $false) } | FT Name,SamAccountName,UserPrincipalName,EmailAddress |
Consistency saves confusion when performing migrations, ADFS password resets, logging in to O365, etc.