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

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering System Center 2012

During over 6 hours of training you can join John Savill from your computer as he will walk you through the key components and capabilities of System Center 2012, what’s involved in using the components, and the benefit they can bring to your environment.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.