Users in an OU versus users in a Group
Posted on 2006-05-24
From the code like this:
Set objCon = CreateObject("ADODB.Connection")
Set objCmd = CreateObject("ADODB.Command")
Set objCmd.ActiveConnection = objCon
objCmd.CommandText = "<LDAP://10.0.0.1>;(&(objectCategory=Group)(cn=Group1));distinguishedname,name,member;range=0-9;subtree"
Set objRS = objCmd.Execute
Do While (Not objRS.EOF)
WScript.Echo Join(objRS("member;range=0-9"), vbCrLf)
I can now get all the users in a Group (with a range) ......... however, if I try to get all the users in an OU (with a range) (which I know the code above might change a little) I am having trouble with the objCmd.CommandText line ..... if the OU=NeedVacation, how could I modify the query to work for the OU?