0
votes

Toying with a Lotus Notes to Active Directory connector, I managed to change all my user's Name, CN and distinguishedName fields to resemble an email address. ugh. All seems fine aside from maybe 1 utility that used cn/ldap to reference AD, but it looks bizarre in AD users and computers.

I'd like to rewrite users name fields as to update it back to how it used to look (This fixes cn and dn fields I see). Preferably using AD Powershell or Exchange Management shell.

When using exchange management shell and writing to the name field, it also rewrites the "showinaddressbook" values. (figure this must be an exchange thing, but I can't have it happen). Here's what I did:

$displayname = Get-MailUser -Identity joe.user | select -ExpandProperty Displayname

Set-MailUser -Identity joe.user -Name $displayname

When attempting to use AD Powershell and do something similar, it doesn't look possible to write to the name field with "set-aduser". I'm not overly schooled in doing this. But I'd like to be able to rewrite the name field with "givenname surname" or "displayname" (preferred). And somehow loop through all my users without affecting the "showinaddressbook" exchange attribute.

2

2 Answers

0
votes

If I'm following you... you need to use the Rename-ADObject cmdlet.

0
votes

you can change the CN by using the command below, however the CN is the name that will show in AD OU and it's same as Full Name

Set-ADUser $Username -PassThru | Rename-ADObject -NewName $FullName