Page 1 of 1 1
Topic Options
#35961 - 2003-02-03 10:35 PM Get groups array.
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Hi Korg. Roundabout today eh?
I would like to know if there is a way of getting all groups into an array. I searched and found that GetGroups() retrieves the group of an account. I need select * from groups.
Thanks very much in advance.
_________________________
Life is fine.

Top
#35962 - 2003-02-03 10:40 PM Re: Get groups array.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Start with GewtGroups() and modify it to retrieve all groups in a domain. Something aolong the line of $oAccount=getobject("WinNT://$Domain,group")
_________________________
There are two types of vessels, submarines and targets.

Top
#35963 - 2003-02-03 10:56 PM Re: Get groups array.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I guess I should add that (GroupEnum) to Win32ADmin.DLL
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#35964 - 2003-02-04 12:55 AM Re: Get groups array.
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Thanks for the answer.
Sorry boys i dont have the skill for making it work.
IŽll study it a little more so as to undertand it better when I have an answer I meet you in the same place at the same channel.
By now I solved the problem by hand. Thanks very much indeed.
_________________________
Life is fine.

Top
#35965 - 2003-02-04 01:33 AM Re: Get groups array.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Sorry for the late code sample. But the groups are in an array of sorts in the sample below. Additional code can actually add select items into a KiXtart array if you like.



$object = GetObject("WinNT://dss_test,domain")
$object.filter = "group",""
For Each $group In $object
    $name = $group.Name
    $type = $group.groupType
    Select
        case $type & 2 $typename = " - Global Group"
        case $type & 4 $typename = " - Local Group"
        case 1         $typename = " - Unknown Type( " + $type + " )"
    Endselect

    ? $name + " " + $typename
Next



[ 04. February 2003, 01:35: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#35966 - 2003-02-04 02:01 AM Re: Get groups array.
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Thanks very much Howard. [Smile]
I ended using this part of your script. My intention was to fill a combo with that info.
Now i can make a function no?

code:
Function ThanksToHowardTheComboIsFull()
$object = GetObject("WinNT://$domain,domain"
$object.filter = "group",""
For Each $group In $object
$name = $group.Name
$ComboGroup.ADDITEM("$name")
Next
Endfunction

Do u think this could join the UDF section?
_________________________
Life is fine.

Top
#35967 - 2003-02-04 04:45 AM Re: Get groups array.
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
er...

userGroups()

Top
#35968 - 2003-02-04 06:10 AM Re: Get groups array.
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Jose,

A question... Are you using NT 4.0 Domain or a 2000 AD Domain structure?

The code examples so far will not work with Universal Groups from the Active Directory.

I can probably show you some if you need them.

[ 04. February 2003, 06:23: Message edited by: NTDOC ]

Top
#35969 - 2003-02-04 03:10 PM Re: Get groups array.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You can add:

case $type & 8 $typename = " - Universal Group"

for universal groups. Although I don't have any Universal group to test, I do not see why the Winnt:// provider would not return them. If not then you will have to switch to the LDAP:// provider. The groupType code still will work.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#35970 - 2003-02-04 07:02 PM Re: Get groups array.
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Here i go again.
Thanks for the replies boys. I am using Nt NTDOC. I know this is not very typical or common but my idea was to bring array groups to a combo and onClick() show the users in another combo.
I will apply it to choose a group, then choose a user, then send message or whatever.
This works so far it might not look tidy but does.
Surely there is an easy way, I dont know.

code:
;bring the array containing all the groups and load it into the combo
$object = GetObject("WinNT://$dominio,domain")
$object.filter = "group",""
For Each $group In $object
$name = $group.Name
$ComboGrupo.ADDITEM("$name")
Next

;load the user combo according to the group chosen
Function ComboGrupo_Click()
$ComboUsuario.CLEAR
$GroupSelected=$ComboGrupo.TEXT
$members = groupmembers("$domain","$GroupSelected")
For Each $ITEM IN $members
$ComboUsuario.ADDITEM("$ITEM")
Next
EndFunction

Thanks very much for the answer.....again [Big Grin]

[ 04. February 2003, 20:04: Message edited by: jose3 ]
_________________________
Life is fine.

Top
#35971 - 2003-02-06 11:49 AM Re: Get groups array.
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Howard,

The WinNT provider did/does not understand Universal Groups. In this case not an issue as Jose says he is running NT 4.0

However, if you perform IF INGROUP calls to a Universal group using WinNT provider information your call will always fail, as it can not get that information.

I can't find the link, but Microsoft does have a good page that shows the commands that can be used by WinNT and those they require LDAP calls.

Another example is that you can add a user to a group with WinNT provider, but I don't think you can do an IsMember I've not done a lot of testing with this yet, but preliminary testing I've done comes back invalid. i.e. always returns TRUE even if it is FALSE.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1782 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.075 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