From: Karl E. Peterson on
Paul Clement wrote:
> ý That's kinda fuzzy, here. I'm logged into a domain known as
> "langroup", but I get
> ý "DC=clark,DC=root,DC=local" from that example (which corresponds to
> my primary DNS
> ý suffix of "clark.root.local"), same as your objSystemInfo.UserName
> suggestion.
>
> Yeah forgot to add a step. Both are returning the DNS name and not
> the actual domain name. If you want the "domain" name you need to
> fetch another directory object using the DNC value. The Name property
> of the directory object contains the relative name for the domain.
>
> Set objRootDSE = GetObject("LDAP://RootDSE")
> Set objDomainObject = GetObject("LDAP://" &
> objRootDSE.Get("defaultNamingContext"))
> MsgBox objDomainObject.Name

That returns 'DC=clark' here, not 'langroup' (the actual domain name).
--
Working Without a .NET?
http://classicvb.org/petition


From: Paul Clement on
On Mon, 20 Jun 2005 15:57:42 -0700, "Karl E. Peterson" <karl(a)mvps.org> wrote:

ý Paul Clement wrote:
ý > ý That's kinda fuzzy, here. I'm logged into a domain known as
ý > "langroup", but I get
ý > ý "DC=clark,DC=root,DC=local" from that example (which corresponds to
ý > my primary DNS
ý > ý suffix of "clark.root.local"), same as your objSystemInfo.UserName
ý > suggestion.
ý >
ý > Yeah forgot to add a step. Both are returning the DNS name and not
ý > the actual domain name. If you want the "domain" name you need to
ý > fetch another directory object using the DNC value. The Name property
ý > of the directory object contains the relative name for the domain.
ý >
ý > Set objRootDSE = GetObject("LDAP://RootDSE")
ý > Set objDomainObject = GetObject("LDAP://" &
ý > objRootDSE.Get("defaultNamingContext"))
ý > MsgBox objDomainObject.Name
ý
ý That returns 'DC=clark' here, not 'langroup' (the actual domain name).

Well I can't really explain that other than to say that whoever set up your Active Directory domain
chose not to use your domain name as the top level DC name for the LDAP path of your domain
controller.

Perhaps they had a reason for doing that which I'm not aware of but that makes it a bit more
difficult to work interchangeably between the WinNT and LDAP (if you're working with Active
Directory programmatically).


Paul
~~~~
Microsoft MVP (Visual Basic)
From: Karl E. Peterson on
Paul Clement wrote:
> Well I can't really explain that other than to say that whoever set
> up your Active Directory domain chose not to use your domain name as
> the top level DC name for the LDAP path of your domain controller.
>
> Perhaps they had a reason for doing that which I'm not aware of but
> that makes it a bit more difficult to work interchangeably between
> the WinNT and LDAP (if you're working with Active Directory
> programmatically).

I suppose. It's a pretty complex setup, with numerous domains, trusted and
untrusted. My point was, and I guess still remains, that using WMI for this is
potentially problematic. Then again, perhaps we just haven't hit on the right
property? Thanks...
--
Working Without a .NET?
http://classicvb.org/petition


From: Paul Clement on
On Tue, 21 Jun 2005 12:38:05 -0700, "Karl E. Peterson" <karl(a)mvps.org> wrote:

ý Paul Clement wrote:
ý > Well I can't really explain that other than to say that whoever set
ý > up your Active Directory domain chose not to use your domain name as
ý > the top level DC name for the LDAP path of your domain controller.
ý >
ý > Perhaps they had a reason for doing that which I'm not aware of but
ý > that makes it a bit more difficult to work interchangeably between
ý > the WinNT and LDAP (if you're working with Active Directory
ý > programmatically).
ý
ý I suppose. It's a pretty complex setup, with numerous domains, trusted and
ý untrusted. My point was, and I guess still remains, that using WMI for this is
ý potentially problematic. Then again, perhaps we just haven't hit on the right
ý property? Thanks...

Well it's mostly a matter of naming conventions and capability. If you want WinNT then stick with
the network APIs, the ADSI WinNT provider or the environment variable. The ADSI LDAP provider has
more capability and exposes more functionality but uses different naming conventions. I actually use
both since I've found the ADSI LDAP provider to be buggy in a couple of instances.


Paul
~~~~
Microsoft MVP (Visual Basic)