Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem defining CN using comma in Active Directory

Status
Not open for further replies.

williey

Technical User
Jan 21, 2004
242
I ran into a problem when I try to add users to AD when using lastname and firstname separate by a comma.

example of a DN for the add command is such

cn=Doe, Jane,ou=x,dc=xx,dc=com

It results in problem 2006 (BAD_NAME) error.

I use a combination of variables to create the DN.

Code:
$dn="$cn,$xyz_base,$base2";

How can I get around the error?
 
I know I don't really understand what you are doing, but can you escape the comma?

$xyz_base =~ /,/\\,/g;

 
I'm trying to create a DN where the CN consist of a comma.

Such as "Doe, Jane". However, due to the comma, I getting a error. If I remove the comma, the problem is solved.

I had tried escaping the comma with single an double backslash.

Here is the snippet of the code

Code:
my $base1="ou=users,ou=level2,dc=solos,dc=abc,dc=com";
my $base2="dc=abc,dc=com";
my $corporate_base="cn=users";
my $it_base="ou=xyz";
my $center_base="ou=center";

   $cn=$lastname . ", " . $firstname;
      $dn="cn=$cn,$it_base,$base2";
 
I finally fixed it.. I replaced the use of double quotes to single quotes.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top