Hello,
You may seen crappy names in Active Directory due to a lot of turn over in the team managing users accounts, hereunder a few line to make this a bit cleaner :
Get-ADUser -Filter * -SearchBase "OU=Production,DC=D2K12R2,DC=local" -Properties sn,givenname | % { $GivenName = [System.Globalization.CultureInfo]::CurrentCulture.TextInfo.ToTitleCase("$($_.givenname)".ToLower()) $SurName = $_.sn.ToString().ToUpper() $DisplayName = "$SurName $GivenName" Set-ADUser -Identity $_.samaccountname -DisplayName $DisplayName -GivenName $GivenName -Surname $SurName Get-ADUser -Identity $_.samaccountname | Rename-ADObject -NewName $DisplayName $GivenName = $SurName = $DisplayName = $null }
Before :
After :
That’s a good start. Remember, if you use some of Office 365 services, it will help you have a nicer global address list and Lync contact list.