Dsquery and escaping characters
Is it possible for dsquery to escape double quotes that are listed in a user account's common name? Backslashes do not seem to work. For example:
CN=Jonathan "Johnny" Doe
January 13th, 2012 10:37am
The proper way to escape the quote character is with the backslash character, but dsquery does not do this. My solution is to redirect the output of dsquery to a text file, then modify the text file to replace all embedded quote characters with \" (not the
quotes enclosing the distinguished names). Then I can pipe the contents of the file to the dsget command, for example. My discussion in a wiki documenting characters that need to be escaped in AD is linked here:
http://social.technet.microsoft.com/wiki/contents/articles/5312.aspx#Command_Line_Utilities
Note the filter mentioned in the link, (name=*\22*), that can be used to find all cases where the relative distinguished name includes a quote character, to assist in editing the text file. I know of no other solution. I would call this behavior
of dsquery a bug.
Richard Mueller - MVP Directory Services
Free Windows Admin Tool Kit Click here and download it now
January 13th, 2012 11:31am
I would agree that it's probably a bug or an oversight. Thanks.
January 13th, 2012 12:19pm