Hi guys,
have a little problem.
I'm trying to write a script to automatically move disabled accounts
onto the appropriate OU. The problem is, I do not want all the domain
users to be included in the search. Only from a given OU downwards.
So, I figured out two alternatives:
- do not use a dynamic bind to the directory but use a "hard-coded"
bind to the OU where the users to be searched exist.
- do a normal bind to the active directory and then set the scope
accordingly.
So my question is:
is it possible to bind to the current domain as follows:
Set objADsRootDSE = GetObject("GC://RootDSE")
strADsPath = "GC://" & objADsRootDSE.Get("rootDomainNamingContext")
strBase = "<" & strADsPath & ">"
Set objADsRootDSE = Nothing
And then tell ADO to perform the search only on a given path (see
strScope), ie:
strObjects = "(objectCategory=person)"
strFilter = "(&" & strObjects & ")"
strAttributes = "distinguishedName, userAccountControl,
SAMAccountName, cn"
strScope = "ou=bla,dc=my,dc=domain,dc=org"
I tried like this but nothing, it does not work...
??????
Alternatively, I tried the second solution, ie to do a "hard" bind to
the domain:
Set objADsRootDSE =
GetObject("LDAP://ou=bla,dc=my,dc=domain,dc=org")
And use the strScope = "subtree"
but the script still fails...
If anybody can help me on this matter I would be very grateful!
Thanks
Bar