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 and others will put 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 = $
    $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}

Function: Get AD User Password Expiry Date/Time

This is a PowerShell Function written to obtain a users password expiry date and time in a friendly format. It allows you to search using a username, first name or surname. This may be useful on a helpdesk to ascertain if the issue a user is experiencing is due to password expiry.

Read more “Function: Get AD User Password Expiry Date/Time”