
Error connecting to AD using ADSI and LDAP on NT4
I'm having a problem with a VBScript I initially wrote and tested on a
Windows 2000 client, running on an NT 4 client (both using scripting engine
5.1 and 5.5, and ADSI 2.5, NT4 SP6a).
I'm trying to use the getobject method using the LDAP syntax, sorta like
(just an example, I haven't got the script to hand - I'm at home, but this
is the relevant bits, from memory...):-
set Dse=getobject("LDAP://RootDSE")
strDomain="LDAP://"&Dse.Get("defaultNamingContext")
set Domain=getobject(strDomain)
set ParentOU=Domain.getobject("organizationalUnit","OU=Computers")
...and so on.
Background: what I want to do is group desktop PCs (NT4 workstations
(specifically their AD objects), clients to a W2K domain in native mode) in
OUs with the printer objects, then, in the login script, search all the
relevant OUs to find the OU that the PC is in, identify the printers in that
OU, then create connections to the printer(s).
The script works just peachy on Windows 2000 clients, opens AD, using LDAP,
identifies and navigates the appropriate OUs, and creates the printer
connections OK. However when I try and run the script on NT4 machines
(versions as above), it fails as soon as it gets to the "set
Dse=getobject("LDAP://RootDSE")" line, (from memory the error is 8007001f).
Other scripts I've played with in testing, on these NT4 clients, correctly
identify LDAP as a usable namespace.
I'm pretty new to vbscript / WSH / ADSI - I previously did most of this sort
of thing using Kixtart, and I'm sorta learning this as I go. I was sort of
under the impression that (assuming the same versions of the scripting
engine, and ADSI support) that scripts should work across platforms.
Can anyone let me know what I'm doing wrong, and / or suggest a technique
that will work, cross-platform, in which I can descend OU hierarchies,
searching (using filters) as I go?
Thanks in advance for any help.