Discussion:
How to find DC object guid with LDAP
(too old to reply)
Brian Nielsen
2006-02-21 12:47:29 UTC
Permalink
Hi

I'm having a Visual Basic 6 program that creates a group on 1 site in an
Active Directory domain (Win2k3).

I want this group to be replicated immediately to the other sites.

Therefore I'm using the repadmin command through the VB program too.
But to use the "repadmin /replsingleobj" I must provide the DC object GUID
of the source.

The problem is that I cannot find the correct GUID to use.
When writing "repadmin /showrepl" I can see the guid to find, so now I just
need to find the same guid using LDAP.

I have tried retrieving the ADSI object for the local Domain Controller, but
the GUID retrieved by IADS.Guid is not equal to the one found by the repadmin
tool.

Can someone tell me, what directory object I need to retrieve in order to
find the right object GUID to use in the repadmin command?

Best regards
Brian
Joe Kaplan (MVP - ADSI)
2006-02-22 04:54:28 UTC
Permalink
Can you read the objectGUID attribute in binary from the property cache and
use that binary GUID to convert it a "string" GUID? There is a Win32 API
that does this, StringFromGUID2. This is also trivial in .NET. However,
I'm not sure if there is anything built into VB6 that does this. The GUID
property on IADs is the native guid format, which is really the binary data
as a string of hex pairs.

The other thing you can do is take the GUID property and switch the bytes
around to form the actual string GUID. Each byte is 2 characters. The
mapping of bytes goes like this:
4 3 2 1 6 5 8 7 9 10 11 12 13 14 15 16

Best of luck,

Joe K.
Post by Brian Nielsen
Hi
I'm having a Visual Basic 6 program that creates a group on 1 site in an
Active Directory domain (Win2k3).
I want this group to be replicated immediately to the other sites.
Therefore I'm using the repadmin command through the VB program too.
But to use the "repadmin /replsingleobj" I must provide the DC object GUID
of the source.
The problem is that I cannot find the correct GUID to use.
When writing "repadmin /showrepl" I can see the guid to find, so now I just
need to find the same guid using LDAP.
I have tried retrieving the ADSI object for the local Domain Controller, but
the GUID retrieved by IADS.Guid is not equal to the one found by the repadmin
tool.
Can someone tell me, what directory object I need to retrieve in order to
find the right object GUID to use in the repadmin command?
Best regards
Brian
Continue reading on narkive:
Loading...