When I do this stuff in volume, I go ahead and escape the entire darn thing so I don't get confused. I wrote an article about it a long time ago:
http://theessentialexchange.com/blogs/michael/archive/2007/11/13/working-with-binary-data-guids-in-vbscript.aspx The core content being: Function myADsEncodeBinaryData (arrByte) Dim str, s, i str = OctetToHexStr (arrByte) ''WScript.Echo "Length = " & len(str) & " '" & str & "'" s = "" For i = 1 to Len (str) Step 2 s = s & "\" & Mid (str, i, 2) Next ''WScript.Echo s myADsEncodeBinaryData = s End Function Function OctetToHexStr (arrbytOctet) ' Function to convert OctetString (byte array) to Hex string. ' Code from Richard Mueller, a MS MVP in Scripting and ADSI Dim k OctetToHexStr = "" For k = 1 To Lenb (arrbytOctet) OctetToHexStr = OctetToHexStr _ & Right("0" & Hex(Ascb(Midb(arrbytOctet, k, 1))), 2) Next End Function Regards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com -----Original Message----- From: Mike Leone [mailto:oozerd...@gmail.com] Sent: Thursday, July 14, 2011 11:15 AM To: NT System Admin Issues Subject: Re: ADFIND not finding by homeDirectory (sometimes) On 7/14/2011 11:00 AM, Michael B. Smith wrote: > No. you replace each backslash by \5c. The '\' means that the next two > characters are to be treated as hexadecimal characters. So... > > adfind -f homeDirectory=\5c\5cnt_san1\5cusers\5cabneyw sAMAccountName > > Granted, not very readable. Now, THAT is what I call UGLY. LOL But it works, and that's the important thing. OK, so I will go re-work my script to use "\5c" instead of "\" in the filter parameter for ADFIND. Thanks! > > Regards, > > Michael B. Smith > Consultant and Exchange MVP > http://TheEssentialExchange.com > > > -----Original Message----- > From: Mike Leone [mailto:oozerd...@gmail.com] > Sent: Thursday, July 14, 2011 11:00 AM > To: NT System Admin Issues > Subject: Re: ADFIND not finding by homeDirectory (sometimes) > > On 7/14/2011 10:34 AM, Michael B. Smith wrote: >> See "Special Characters" > > D'OH! Of course ... > >> >> http://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx >> >> That answers your specific question. A more complete handling of escape >> characters is here: >> >> http://www.rlmueller.net/CharactersEscaped.htm > > OK, the escape characater is \, right? So I'd need to preface each \ in > the filepath with a \? None of these seems to work .. > > > Z:\>adfind -f homeDirectory=\\\\nt_san1\\users\\abneyw sAMAccountName > Z:\>adfind -f "homeDirectory=\\nt_san1\users\abneyw" sAMAccountName > > > So I guess a need another dose of the clue-bat .... > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to listmana...@lyris.sunbeltsoftware.com > with the body: unsubscribe ntsysadmin > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to listmana...@lyris.sunbeltsoftware.com > with the body: unsubscribe ntsysadmin > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin