4

Is there a way, using PowerShell, to change the AD format of the usernames to Lastname, Firstname?

I know how to do it manually like the answer given here. I am trying to see if I can add this to a script that I am putting together.

Thanks!

Edit

After digging a little deeper from this article here I was able to figure it out.

$domain = $env:USERDOMAIN
$uddn = "cn=user-display,cn=409,cn=displayspecifiers,cn=configuration,dc=$domain,dc=com"
$ud = [ADSI]"LDAP:// $uddn "
$ud.Put("createDialog","%<sn>, %<givenName>")
$ud.SetInfo()
  • 1
    Are you asking if you can modify the createDialog attribute using PowerShell? – jscott Feb 11 '16 at 22:31
  • Yes that is exactly what I am trying to accomplish if possible. – jdycus002 Feb 12 '16 at 13:28
  • Yes, you can modify the createDialog attribute using PowerShell. What have you tried? Which part isn't working? Please add any code as an edit to your question. – jscott Feb 12 '16 at 18:04
  • I am still fairly new to powershell. I have not written this part of the script yet as I have not been able to find any powershell examples online as to how to do it. The rest of the script add's OU's, Groups and Users things of that nature. Any guidance on how to accomplish this would be greatly appreciated. – jdycus002 Feb 12 '16 at 18:46
  • Cool, glad you resolved this. You should post your answer as such so you can mark it as accepted. – jscott Feb 12 '16 at 23:03
2

After digging a little deeper from this article here I was able to figure it out. Here is what I came up with.

$domain = $env:USERDOMAIN
$uddn = "cn=user-display,cn=409,cn=displayspecifiers,cn=configuration,dc=$domain,dc=com"
$ud = [ADSI]"LDAP:// $uddn "
$ud.Put("createDialog","%<sn>, %<givenName>")
$ud.SetInfo()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.