Page 1 of 1 1
Topic Options
#92054 - 2003-05-19 03:32 PM Enumerating Group members
cpoyner Offline
Fresh Scripter

Registered: 2002-11-06
Posts: 33
I'm currently trying to enumerate a list of computer accounts that belong to a group. I think I'm going to need to adsi bind to the group but I can't find the right syntax anywhere. Here's what I have so far for reference.

My end goal is just be able to list out all the members of a group.

code:
$Computer = GetObject("WinNT://" + @domain + "/" + @wksta + "$$")    
for each $Group in $Computer.Groups
?$Group.Name
if $Group = "somegroup"
$Members = $Group.Members
for each $member in $Members
?$member.name
next
endif
next


Top
#92055 - 2003-05-19 03:41 PM Re: Enumerating Group members
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Have you tried looking at some recent threads on the board? There has been a lot of talk lately about computers in groups and OUs.

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=007188
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#92056 - 2003-05-19 03:49 PM Re: Enumerating Group members
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Something like:


$group = getobject("WinNT://$Domain/$Group,group")
for each $user in $group.members
? $user.name
next
next

I no longer have a test group with computers in it. Does this display what you are looking to see.

[ 19. May 2003, 15:50: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#92057 - 2003-05-19 03:56 PM Re: Enumerating Group members
cpoyner Offline
Fresh Scripter

Registered: 2002-11-06
Posts: 33
Worked great Howard, thanks for helping me out again. Great job!
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.049 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org