Auditing: Format Active Directory Email Addresses

Perhaps this is just my own OCD but I think email addresses should all be formatted in the same way in active directory but inevitably some will put john@company.com and others will put John@company.com and all variations in between. 

The below can be run to fix the formatting as you like it and will change all email addresses to your desired format.

$users = Get-ADUser -filter * -Properties name,samaccountname,mail  | Select-Object name,samaccountname,mail
foreach ($user in $users) {

    $Name = $user.name
    $UserID = $user.samaccountname
    $Email = $user.mail
    $NewEmail = (Get-Culture).TextInfo.ToTitleCase("$email")
try {
set-aduser $UserID -EmailAddress $NewEmail 
}
catch {write-host "The email field for $Name is blank" -ForegroundColor Red}
}
$users.Count