Binary Searches using ADO in Script

  • Thread starter Thread starter Scott cooper
  • Start date Start date
S

Scott cooper

How do I query for a GUID in ADO VBScript? The only refearance I find says
the ADsEncodeBinaryData function is used to convert the data to string that
can be used for the search but this non-automation function is not
accessable to script nor vb as object, far as I know. I hope someone can
help,

Thank you in advance!
Scott
 
PSDK shows an example for binding using GUID in C++ but this does not seem
to help. Can anyone help me with a VB example for binding to an object using
it's GUID?

Thanks in advance!
Scott Cooper
 
Scott said:
PSDK shows an example for binding using GUID in C++ but this does not seem
to help. Can anyone help me with a VB example for binding to an object using
it's GUID?

In VBScript you can bind to an object using the GUID as follows:

strGUID = "2d141d3ed6b7b25da8b6155f49d1209e"
Set objUser = GetObject("LDAP://<GUID=" & strGUID & ">")
 
Scott said:
How do I query for a GUID in ADO VBScript? The only refearance I find says
the ADsEncodeBinaryData function is used to convert the data to string that
can be used for the search but this non-automation function is not
accessable to script nor vb as object, far as I know. I hope someone can
help,

Hi,

The LDAP provider exposes a GUID property method that returns the GUID of
any Active Directory object in a readable form. However, this cannot be used
to search with ADO. Each object has the objectGUID attribute, but this is
OctetString, which is a byte array. I know of no way to query for GUID using
ADO. However, the byte array can be converted to a hex string.

If you have a GUID in hex string format, you can bind to the object and
retrieve name attributes. What exactly are you trying to do? Where do you
get the GUID you are working with, and what do you want to do with it? I
have seen two hex string forms for the GUID, one with dashes, and the other
without dashes, but with some of the bytes transposed.
 
Another nice thing to know is that Win2K AD supports binding with both the
"standard" string form of the GUID as well as the octet string.

So given this guid:
{b95f3990-b59a-4a1b-9e96-86c66cb18d99}

You could bind with this:
<GUID=b95f3990-b59a-4a1b-9e96-86c66cb18d99>
or this:
<GUID=90395FB99AB51B4A9E9686C66CB18D99>

You can also search for guids (or any binary data) with an LDAP filter like
this:
(objectGuid=\90\39\5F\B9\9A\B5\1B\4A\9E\96\86\C6\6C\B1\8D\99)

Joe K.
 
I realized too late that I should have explained that I am attempting to
work with the security descriptors and they return object GUIDs for either
property or objects depending on the access mask value. I thought I could
perform a search using the GUID to get a name of the object or property.
What do you think will work? Thanks.
 
Did my reply on searching against binary attribute values answer your
question?

Joe K.

Scott cooper said:
I realized too late that I should have explained that I am attempting to
work with the security descriptors and they return object GUIDs for either
property or objects depending on the access mask value. I thought I could
perform a search using the GUID to get a name of the object or property.
What do you think will work? Thanks.
 
Back
Top