You don't ask for much do you :-)

If you are using LDAP you can check the .class property of your AD object 
(objUser.Class). If it's of type "group" then don't add it to the list of 
enumerated users.

If it's of type "group" then you want to pass it back into your enumeration 
function/subroutine (you'll need to put this into a routine of some kind so 
that you can make your code handle recursion).

The only thing to be aware of is the possibility of infinite nesting - if you 
have a group that's a member of another group, which in turn is a member of the 
first group, then you'll get OOM (or stack overflow) errors from your script.

Cheers
Ken



From: mck1012 [mailto:[EMAIL PROTECTED]
Sent: Monday, 11 February 2008 5:21 AM
To: NT System Admin Issues
Subject: Script to list users

I need a script to list users of a group and all nested groups with in that 
group.  Here is what I have so far.

I set the File System Object
I set the WshShell
Set ObjGroup to get object from the ldap search

For each objuser in objgroup.members
wscript.echo "SamID:" & objUser.Samaccountname


This will list all users and groups in the group specified in the LDAP search. 
All i want to list is users of that groups and users of any nested group.

Thanks

M C K

~ Upgrade to Next Generation Antispam/Antivirus with Ninja!    ~
~ <http://www.sunbelt-software.com/SunbeltMessagingNinja.cfm>  ~

Reply via email to