SirOracle_
asked on
How to use the dsadd utility to add a user when there is a comma in the CN-part of the DN
I am trying to update the Active Directory in our testlab with the production Active Directory. I hva chosen to use some batch-scripts with dsquery, dsget, dsadd and dsmod to do this.
But our users are in the form "Firstname, Lastname". For instance, a user with first name "Tom" and last name "Olsen" will come out like this from dsquery: "CN=Olsen\, Tom,OU=MyDepartment,DC=MyD omain,DC=c om". But the dsadd utility don't like this:
C:\dsadd user "CN=Olsen\, Tom,OU=MyDepartment,DC=MyD omain,DC=c om"
dsadd failed:CN=Olsen\, Tom,OU=MyDepartment,DC=MyD omain,DC=c om:The name provided is not a properly formed account name.
I have tried to remove the escape-character (the backslash), but that dosn't help. And thats understandable, since it uses a comma to seperate the DN-parts.
Does anyone know how to accomplish this?
But our users are in the form "Firstname, Lastname". For instance, a user with first name "Tom" and last name "Olsen" will come out like this from dsquery: "CN=Olsen\, Tom,OU=MyDepartment,DC=MyD
C:\dsadd user "CN=Olsen\, Tom,OU=MyDepartment,DC=MyD
dsadd failed:CN=Olsen\, Tom,OU=MyDepartment,DC=MyD
I have tried to remove the escape-character (the backslash), but that dosn't help. And thats understandable, since it uses a comma to seperate the DN-parts.
Does anyone know how to accomplish this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well... such are the benefits of brainstorming... where no suggestion is a BAD suggestion (except maybe the suggestion to not make suggestions). :-)
ASKER
It's not the username, but the distinguished name/display name that we use in the form Lastname, Firstname. But you are correct, after some more testing now, I realize that it's not the DN-name that cause the error message, but the username (samid). When I don't spesify a username (parameter -samid and perhaps -upn) dsadd generates a username of the first 20 characters of the CN (Common Name) part of the DN. And since the CN contains a comma, the generated username also contains a comma.
This works:
C:\dsadd user "CN=Olsen\, Tom,OU=MyDepartment,DC=MyD
Thanks for the help!!