GarethColes
MIS
Afternoon All,
I'm fairly sure I'm being a bit daft about this one but I'm stumped so here we go.
I've got a script which we use to pull out lists of members of AD Groups. The problem is that we have some groups which have more than 1000 users in them and these are being truncated to only display 1000 users.
The code for this part of the script is
---------
do while oRS.EOF <> True
dim i
LeftGroup = Left(oRS.Fields("cn"), len(Match))
If Ucase(LeftGroup) = UCase(Match) Then
Set Group = GetObject("LDAP://CN=" & oRS.Fields("cn") & ", " & ADLocn)
WScript.Echo "LDAP://CN=" & oRS.Fields("cn") & ", " & ADLocn
For Each Item in Group.Member
i= i+1
Set User = GetObject("LDAP://" & item)
Name1 = Split(User.userPrincipalName, "@")
Name2 = Name1(0) & ";"
Output.WriteLine Name2
WScript.Echo Name2
Next
wscript.echo "i IS : " & i
End If
oRS.MoveNext
Loop
------------
I know that using RecordSets you can get back more than 1000 results, but how do I get the Group.Member bit to show all the results?
Is it possible to use a SQL command to get this back, in which case I could use a RecordSet and I'd be sorted?
Any help would be greatly appreciated.
Thanks
Gareth
I'm fairly sure I'm being a bit daft about this one but I'm stumped so here we go.
I've got a script which we use to pull out lists of members of AD Groups. The problem is that we have some groups which have more than 1000 users in them and these are being truncated to only display 1000 users.
The code for this part of the script is
---------
do while oRS.EOF <> True
dim i
LeftGroup = Left(oRS.Fields("cn"), len(Match))
If Ucase(LeftGroup) = UCase(Match) Then
Set Group = GetObject("LDAP://CN=" & oRS.Fields("cn") & ", " & ADLocn)
WScript.Echo "LDAP://CN=" & oRS.Fields("cn") & ", " & ADLocn
For Each Item in Group.Member
i= i+1
Set User = GetObject("LDAP://" & item)
Name1 = Split(User.userPrincipalName, "@")
Name2 = Name1(0) & ";"
Output.WriteLine Name2
WScript.Echo Name2
Next
wscript.echo "i IS : " & i
End If
oRS.MoveNext
Loop
------------
I know that using RecordSets you can get back more than 1000 results, but how do I get the Group.Member bit to show all the results?
Is it possible to use a SQL command to get this back, in which case I could use a RecordSet and I'd be sorted?
Any help would be greatly appreciated.
Thanks
Gareth