none
Set CN Name SameAccoutName UserPrincipalName and distinguished name with powershell RRS feed

  • Question

  • I am trying to set a users  CN, Name, SameAccoutName, UserPrincipalName, and distinguished name to uppercase with PowerShell.

    I can set the SAMAccoutName and UPN but I cannot figure out how to set the other 3 attributes.

    I am only changing the names to all uppercase.  nothing  more.  The names will not change just the case. 

    I have a script i have put together to plug in the info so i just need to do one and i will let the script do the rest.  

    Is this possible to change the mentioned attributes with Power-Shell?

    I know the below piece works fine for those 2 attributes just cant get the other 3. 

    Thanks


    Set-ADUser -Identity $user -SamAccountName $upperSAM -UserPrincipalName $upperUPN



    Lishron

    Monday, February 23, 2015 11:02 PM

Answers

  • To set the other 3 attributes (cn, name, and distinguished name) to upper case you need to rename the object.  There is a powershell cmtlet Rename-ADObject to do this.  Assuming you already pulled the current user information and stored the uppercase version of the cn in the $upperCN variable, the following will rename your remaining 3 attributes.  However, only the CN portion of the distinguished name will be updated.  The remainder of the distinguished name will use whatever case the heirarchical containers and domain name uses.

    Rename-ADObject $user -NewName $upperCN

    • Marked as answer by Lishron Tuesday, February 24, 2015 2:07 PM
    Monday, February 23, 2015 11:40 PM

All replies

  • That will not set anything to uppercase.  You are also missing 90% of the script.  What makes you tnink this will work.

    Her is an example:

    $name='SomeName'
    $name.ToUpper()

    In the modern world of computing we do not use all uppercase.  This pracatice was ended in computing shortly after WWII.  Only military teletype maintained this because 90% ot the machines could only pring uppercase.

    Uppercase is harder to read and is basically counter to all modern computer conventions.  I notice that office clerks and data entry people whoare minimally trained in computer data entry like all uppercase because they hate having to use the shift key and being careful to correct text errors.

    Any system that requires uppercase will define an entry method that automatically forces upper case.  AD does not require this.

    For logons and email case is never considered. any case works as all do caseless compares.


    ¯\_(ツ)_/¯

    Monday, February 23, 2015 11:19 PM
  • To set the other 3 attributes (cn, name, and distinguished name) to upper case you need to rename the object.  There is a powershell cmtlet Rename-ADObject to do this.  Assuming you already pulled the current user information and stored the uppercase version of the cn in the $upperCN variable, the following will rename your remaining 3 attributes.  However, only the CN portion of the distinguished name will be updated.  The remainder of the distinguished name will use whatever case the heirarchical containers and domain name uses.

    Rename-ADObject $user -NewName $upperCN

    • Marked as answer by Lishron Tuesday, February 24, 2015 2:07 PM
    Monday, February 23, 2015 11:40 PM
  • Ok - I see that it is just a very badly worded question.

    CN and Name are the same thing.  CN Is Name.  In LDAP/X500 it is called CN. In ADSI Microsoft calls it "Name".

    As noted above DN is dynamically built from the path.

    Do not uppercase everything as it will lead to issues down the road.


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 12:08 AM

  • Well then 2 things are case sensitive.

    WW2 Teletype machines and Microsoft's Tool to copy accounts from a domain to to the Azure cloud services :)

    I know I know i don't get it either.  But I am not working on that part.  The two guys working on that found out if the names i mentioned are not either in all upper or all lower they fail to move.  I have seen it or i would not believe it.

    We had about 6000 fail to move to the Azure service if we changed a few manually to all upper or all lower it worked.  
    I am a very very tiny little fish and the bigger fish are my bosses so i am trying to help.

    It all has to do with the single sign on we use that also talks to a Domino server and a E-Portal for staff.

     

    Lishron

    Tuesday, February 24, 2015 12:57 PM
  • What you are claiming makes no sense.  Look at how many companies move to cloud.  Something else is causing this.  You kludge wil likely only hide and aggravate the problem.  I suspect a configuration error or some other issue with the tools you are using.

    Do not try to do what you are doing. You will never stop regretting it once it is done.

     Post you issue in the Azure forum to get more complete answers on why it appears that you have a case issue.


    ¯\_(ツ)_/¯

    Tuesday, February 24, 2015 3:18 PM