I'm trying to populate Active Directory (AD) by reading in a text file that has distinguished name (DN) values containing commas. How do I denote the commas within the DN?

A. An object's DN is usually in a format similar to "cn=john savill,dc=savilltech,dc=com." However, if the cn component of the name is instead "savill, john", simply using the format "cn=savill, john,dc=savilltech,dc=com" won't work. The directory service component that checks and parses the submitted data won't understand what comes after the first comma; it will be expecting a valid type for a DN. The fix is to place the escape character (\) in front of the first comma, so it would read "cn=savill\, john,dc=savilltech,dc=com". However, if this data is being read from a file, you need to double the escape character so that the program reading in the file doesn't try to interpret the escape sequence (which it will if it sees a single slash). Thus you would write it as "cn=savill\\, john,dc=savilltech,dc=com". If, after you import the data, you use a tool such as ADSI Edit to view the data, you'll see only a single slash, which is the correct format

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.