> I have this simple script that runs fine under windows
> 2000 but it does not run under XP. At first I thought it
> might be Zone Alarm but the script still doesn't work when
> I close Zone Alarm.
> Dim objNameSpace
> Dim Domain
> Set objNameSpace = GetObject("WinNT:")
> For Each Domain in objNamespace
> msgbox Domain.Name
It's not Zone Alarm. I'm not sure it's W2k vs XP. On both W2k and Win9x I
find that at first your code outputs nothing. However, I added similar code
to enumerate the LDAP namespace and ever since both namespaces enumerate my
domain. I have no explanation, but now your snippet works on both clients,
Note that binding to WinNT: (or LDAP:) is usually done to invoke the
OpenDSObject method, with which you can supply alternate credentials.
Perhaps no credentials are required to bind to "WinNT:", so you have no
rights to see anything. If later the client somehow does authenticate you to
WinNT:, you can henceforth see objects in the namespace. Just guessing.
Personnally, I bind to the RootDSE object with the LDAP provider to
determine the DNS domain name. I then use NameTranslate to convert this to
the NetBIOS domain name if I need it. If your intent is to determine the
NetBIOS domain name, then either use RootDSE and NameTranslate, or find some
reliable way to force authentication to the WinNT: namespace. I don't know
how to do that without first knowing the NetBIOS domain name, and I'd hate
to rely on my experience above (binding to LDAP: first). Otherwise, if you
know your client is NT or above, you can use WshShell to retrieve the
UserDomain environment variable.
Microsoft MVP Scripting and ADSI