WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ADSI Special Characters

 Keywords: ADSI Special Characters Escape 1001 Invalid Bad Path 

Almost any characters can be used in Distinguished Names. However, some must be escaped with the backslash "\" escape character. Active Directory requires that the following characters be escaped:

comma,
Backslash character\
Pound sign (hash sign)#
Plus sign+
Less than symbol<
Greater than symbol>
Semicolon;
Double quote (quotation mark)"
Equal sign=
Leading or trailing spaces

The space character must be escaped only if it is the leading or trailing character in a component name, such as a Common Name. Embedded spaces should not be escaped.

In addition, ADSI requires that the forward slash character "/" also be escaped in Distinguished Names. The ten characters above, plus the forward slash, must be escaped in WinBatch when using ADSI. If you view attribute values with ADSI Edit you will see the ten characters above escaped, but not the forward slash. Utilities (like adfind.exe) that do not use ADSI need to have the ten characters above escaped, but not the forward slash.

For example, the following table shows example Common Names as they would appear in ADUC and the corresponding escaping required if the Distinguished Name is hard coded in WinBatch's AD functions:

Name in ADUCEscaped in WinBatch/ADSI
cn=Last, Firstcn=Last\, First
cn=Windows 2000/XPcn=Windows 2000\/XP
cn=Sales\Engrcn=Sales\\Engr
cn=E#Testcn=E\#Test

Some characters that are allowed in Distinguished Names and do not need to be escaped include:

* ( ) . & - _ [ ] ` ~ | @ $ % ^ ? : { } ! ' 
The following characters are not allowed in sAMAccountName's:
" [ ] : ; | = + * ? < > / \ , 
All of these characters are allowed in Distinguished Names, but the last three must be escaped.
Article ID:   W17520
Filename:   ADSI Special Characters.txt
File Created: 2011:02:18:10:31:46
Last Updated: 2011:02:18:10:31:46