Just thought I would post this here in case anyone is after something similar, the question was asked of me today what the longest email address in use at our company was. Short story, a vendor app had limited characters in the email address field and we needed to ensure compatibility.
Anyway I wrote a simple PS 3 script to list the email address's and their length:
Import-Module ActiveDirectory Get-ADUser -filter * -searchbase 'CN=Users,DC=server,DC=com,DC=au' -Properties name,mail | select @{Name="UserName";Expression={$_.name}},@{Name="Mail Length";Expression={($_.mail | Measure-Object -character).Characters}},@{Name="Address";Expression={$_.mail}},@{Name="% of Max";Expression={[int]$per=((($_.mail | Measure-Object -character).Characters)/254)*100 "|" * $per }} | Out-GridView
Even has a nice little graph showing how close it is to the 254 char limit.
If you want to target a specific server use the "-server %servername%" with get-aduser.
Thought it might be useful!