0

I need to change the "fullname" attribute of the profile of some AD users and some OUs. I need the "fullname" attribute to be exactly the same as the "UserPrincipalName" attribute or login name.

Does anyone know of any power shell scripts that can do this?

OBS: It needs to be a script, because it is not possible to install programs to administer AD in the environment.

Overview: I actually need to change the "CN" attribute, I need it to be in the same model as the "UserPrincipalName" but as I researched and saw that it is not possible to change the "CN", I thought of changing the "fullname" given that the "CN" is based on the "Fullname"

  • Give `Get-ADUser username |Rename-ADObject -NewName {$_.UserPrincipalName}` a try (although I'm not sure `@` is allowed in object names) – Mathias R. Jessen Jul 21 '22 at 13:44
  • thank you so much for replying my friend. I did as you said and it ended up working, changed the "fullname". but changed to "$_.UserPrincipalName". And in this case, I did it in a single user, could it be applied to an entire OU? – Fabio Brigoni Jul 21 '22 at 14:08
  • Try `Get-ADUser username |%{$_ |Rename-ADObject -NewName $_.UserPrincipalName}` – Mathias R. Jessen Jul 21 '22 at 14:09
  • worked perfectly. Now would there be any way to apply it to an entire OU? Tried: Get-ADUser -Filter * -SearchBase "OU=Teachers,OU=Collegio1,OU=_Uniidades,DC=contoso,DC=local" |%{$_ |Rename-ADObject -NewName $_.UserPrincipalName} But it did not work – Fabio Brigoni Jul 21 '22 at 14:27
  • I don't know if I explained myself well either, but I need to apply this change to a user group. – Fabio Brigoni Jul 21 '22 at 14:41
  • Does anyone have any idea how I can make this change for multiple users? Make the change in multiple users of an OU? – Fabio Brigoni Jul 21 '22 at 18:43

0 Answers0