From: Maw on
Hi all,
i'm tring to search a user in AD and add it to a group from a file(txt
or excel it's not important).
My problem is find the user in all OU AD.
It's possible the user is in evry OU (ex.):
ou=test,dc=domain,dc=com
or in
ou=marketing,ou=division,dc=domain,dc=com

I write a script for a specific OU(i know the user path and group
Path):
strOU = "OU=import,"
strOUg = "OU=Sedi,"
strUser = "CN=Bill Gates"
strGroup = "CN=grup test"

' Bind to Active Directory and get LDAP name
Set objRootLDAP = GetObject("LDAP://RootDSE")
strDNSDomain = objRootLDAP.Get("DefaultNamingContext")

' Add (str)User to (str)Group
Set objUser = GetObject("LDAP://"& strUser & strOU & strDNSDomain)
Set objGroup = GetObject("LDAP://"& strGroup & strOUg & strDNSDomain)
objGroup.add(objUser.ADsPath)

Someone can explain me who i can find the user and the group in all
subtree ou???

Thx in advance