Page 1 of 1 1
Topic Options
#89358 - 2002-11-13 04:54 PM Global or Local Group
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
I stole (oops..I mean found..) some code out here that enumerates the groups in a domain and taylored it to meet my needs, I only have one problem now. How can I tell if these groups are global or local? Here's a copy of the script..
code:
 
BREAK ON
$DOMAIN = GetObject("WinNT://MYDOMAIN")
$DOMAIN.FILTER = "group",""
FOR EACH $GROUP in $DOMAIN
? $GROUP.NAME
NEXT

Also, is there some downloadable reference that tells me what properties I can use under $domain.??

Thx..

Top
#89359 - 2002-11-13 05:15 PM Re: Global or Local Group
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
Thanks for the post, but I guess I should've mentioned that I'm a newbie to vb scripting and don't understand his code fully. Do I need the whole UDF to tell if the group I'm querying is a local or global group? What I'm looking for is..

code:
BREAK ON
$DOMAIN = GetObject("WinNT://CORP")
$DOMAIN.FILTER = "group",""
FOR EACH $GROUP in $DOMAIN
IF THIS GROUP IS A LOCAL GROUP
? $GROUP.NAME
ELSE
ENDIF
NEXT

Thanks for the post..

Top
#89360 - 2002-11-13 05:22 PM Re: Global or Local Group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The code below is part of the GetGroups UDF in the UDF Library.

This set an array of the names of the types of groups. They are positioned in the array such that the index represents the grouptype value. (You will see this later)
code:
   Dim $Type[8]
$Type[2] = "GLOBAL_GROUP"
$Type[4] = "LOCAL_GROUP"
$Type[8] = "UNIVERSAL_GROUP"

This code gets the name and grouptype values using COM. The grouptype value is used as the index while referencing the $Type array. This will set the group type TEXT from above into your $GroupType variable.

code:
$GroupName = $group.Name
$GroupType = $Type[$group.groupType]

Does this help or do I need to explain further?

[ 13. November 2002, 18:08: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#89361 - 2002-11-13 06:09 PM Re: Global or Local Group
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
OK...I get it now... [Big Grin] Thank you..

One question though. How do you know that GroupType is a property of group? Is there a resource somewhere that references that?

Top
#89362 - 2002-11-13 06:16 PM Re: Global or Local Group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
A good place to start is the ADSI help file which can be downloaded from Microsoft's site.

The next step is to run my EnumObjProps.kix against the object to enumerate the properties. You will find it at: http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=13;t=000139#000003

Note that the properties and their names vary when you use the WinNT:// or LDAP:// ADSI providers.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#89363 - 2002-11-13 06:27 PM Re: Global or Local Group
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
Dude...you're good!!! This is just what I needed... Thanks for your help!! [Big Grin]

L8tr...

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 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.052 seconds in which 0.022 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