Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Filter Command

Status
Not open for further replies.

cchipman

IS-IT--Management
Sep 16, 2002
125
US
How come the .Filter assignement does not always work? When I try to do a listing of all my groups in a container, and then to list out all of the user accounts in the group, it also lists groups that might be a member of the group.

Anyone know why that is?

here's a snippet

Code:
On Error Resume Next

	Set oContainer = GetObject("LDAP://ou=groups, dc=yourdomain,dc=com")
	For Each object In oContainer
		Set oClass = GetObject(object.Schema)
		If (oClass.Container) Then 
			Set objGroup = GetObject(object.ADsPath)
			objGroup.Filter = Array("group")
			For each objMember in objGroup.Members
				If objMember.class = "user" Then
					groupname = split(object.Name, " ")
					Wscript.Echo JobList(Mid(groupname(0),4))& ", " & Mid(groupname(0),4)  & ", ," & objMember.sAMAccountName & ","
				Else
					WSCript.Echo objMember.class & "--" & objMember.Name
				End If
				
			Next
		End If
	Next

why does its still list some groups? (shown in the

Code:
WSCript.Echo objMember.class & "--" & objMember.Name

line.
 
>why does its still list some groups? (shown in the
>CODE
>[tt]WSCript.Echo objMember.class & "--" & objMember.Name[/tt]
>line.
Is it not the place to show it? as it fails the .class="user" test?
Furthermore, can you not spare the .container then getobject(object.adspath) part? and directly apply the filter to oContainer?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top