Page 1 of 2 12>
Topic Options
#163630 - 2006-06-26 11:26 AM How to use InGroup ???
SASKINN Offline
Fresh Scripter

Registered: 2006-06-06
Posts: 10
an example:

If InGroup("Developers") = 1
? "Member of Developers"
EndIf

its clear that is something/someone is IN the Developers group de text
"Member of Developers" is displayed.

oke, but if I need to check the user(s) "Mike" or "Robert" if he/they is/are in de group "developers" how do i have to do that?

like this????

if "mark" Ingroup("developers")
endif

???

Top
#163631 - 2006-06-26 12:26 PM Re: How to use InGroup ???
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
one way to skin this cat :

Code:

break on

$user = "Mark"
$Group = "Developers"
$ingroup = 0

$objGroup = getobject("WinNT://" + @domain + "/" + $Group + ",group")
if not @error
for each $member in $objGroup.Members
if $member.Name = $user
$ingroup = 1
endif
next
endif

iif($ingroup,$user + " is member of " + $Group, $user + " is not member of " + $Group)

get $

exit 0

_________________________



Top
#163632 - 2006-06-26 01:16 PM Re: How to use InGroup ???
SASKINN Offline
Fresh Scripter

Registered: 2006-06-06
Posts: 10
it doesnt seem to work...

the active directory group is like this:

companyName.CORP
-HQ Office
--Groups
---Resource Groups
----Projects
-----A Project
......--- A Project Modify
......--- A Project Read
-----B Project
......--- B Project Modify
......--- B Project Read
-----C project
......--- C Project Modify
......--- C Project Read


I want to look in the A Project Modify group if the user "Martin" is member of the group OR look if the Department "Sales" is IN the A Project Modify group.

Thanks if you can help me.

Top
#163633 - 2006-06-26 01:28 PM Re: How to use InGroup ???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
resource groups?
not sure what those are but know that security info is only available on security groups.
_________________________
!

download KiXnet

Top
#163634 - 2006-06-26 01:39 PM Re: How to use InGroup ???
SASKINN Offline
Fresh Scripter

Registered: 2006-06-06
Posts: 10
the only thing I want is to know if a user is IN the group with the name: "A Project Modify" or not. I dont want to know any security options, only the groupmembership.

groupName: "A Project Modify"
member: "Sales Department"

is Sales Department member of the "A Project Modify" group ??? that is the only thing I want to know!

Top
#163635 - 2006-06-26 02:13 PM Re: How to use InGroup ???
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Is the Machine you run this from actually a member of the domain you want to run this against?

If it is not you should replace @domain with the domain name
_________________________



Top
#163636 - 2006-06-26 08:15 PM Re: How to use InGroup ???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sasskin, no need to be rude.
what did I do to harm you?

just calm down.
_________________________
!

download KiXnet

Top
#163637 - 2006-06-26 10:10 PM Re: How to use InGroup ???
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
I think what Jooel was trying to say is that DISTRIBUTION groups will not be found. Only SECURITY GROUPS.
Top
#163638 - 2006-06-26 10:12 PM Re: How to use InGroup ???
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well, Jooel didn't really read the first post too well. It is not about sec vs. distro and all about InGroup() supporting only inferred @UserID and not supporting other names as parms.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163639 - 2006-06-26 10:13 PM Re: How to use InGroup ???
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Afaik if groups are placed in OU's WinNT:// calls will fail. You'll have to specify the full LDAP path of the groupname or username/computername. You can get those path's with Howard's TranslateName Function in the UDF collection.
Top
#163640 - 2006-06-26 10:16 PM Re: How to use InGroup ???
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Les and Apronk are correct (I did not fully read the post either )


WinNT provider does not understand the OU structure and LDAP must be used.

Translate name seems to be the best solution around here for that.

TranslateName() - converts a name from one type to another
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=82426


Edited by NTDOC (2006-06-26 10:17 PM)

Top
#163641 - 2006-06-26 10:55 PM Re: How to use InGroup ???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah, he talked about ingroup and he talked about retrieving the info about others.
but, winnt-provider would work fine for normal security groups.
so his issue is that he is not using them, right?
_________________________
!

download KiXnet

Top
#163642 - 2006-06-27 12:10 AM Re: How to use InGroup ???
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
It's because he wants to check for a user other then the one that is currently logged on (not sure why). That requires a more in depth check using LDAP.
Top
#163643 - 2006-06-27 08:46 AM Re: How to use InGroup ???
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Not too correct: I ran this against a local group checking for group membership of a global group successfully... and these groups are organized in different OUs.

Code:

break on

$what = "GlobalGroupname"
$Group = "LocalGroupname"
$ingroup = 0

$objGroup = getobject("WinNT://MyADDomain/" + $Group + ",group")
if not @error
for each $member in $objGroup.Members
if $member.Name = $what
$ingroup = 1
endif
next
endif

iif($ingroup,$what + " is member of " + $Group, $user + " is not member of " + $Group)

get $

exit 0



So, SASKINN, did you try providing the name of the domain instead of using @domain ?
_________________________



Top
#163644 - 2006-06-27 08:58 AM Re: How to use InGroup ???
SASKINN Offline
Fresh Scripter

Registered: 2006-06-06
Posts: 10
I try it, and it worked good! THANKS!!!!!
Top
#163645 - 2006-06-28 02:02 AM Re: How to use InGroup ???
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
If I put those Groups and Users into a Universal Group (should not put users in a Universal Group) that WinNT provider will fall on it's face and not find anyone because it does not understand Universal Groups.

What you did was look for a user in either a Local or Global group which it does support, but it does not support the Universal Groups.

Top
#163646 - 2006-06-28 08:28 AM Re: How to use InGroup ???
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
That is correct, but nobody asked for universal groups, neither for distribution groups or anything.

Well, I must confess that someday I'll have to deal with that //LDAP provider thingie but not for now

Right, let's recapitulate that the //WinNT provider DOES support OU-structures;

QED
_________________________



Top
#163647 - 2006-06-28 10:11 PM Re: How to use InGroup ???
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Well no I can't do that. It supports the SAM database structure from NT though.

Here is probaby one of the best answers to WinNT vs LDAP that I can find.

http://www.rlmueller.net/WinNT_LDAP.htm

Top
#163648 - 2006-06-28 10:24 PM Re: How to use InGroup ???
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
allright maybe true that it doesn't know about OUs. But still it does enumerate the objects correctly allthough they are in different OUs.
Enough to deal with the Issue here... no need to get nit-picking
_________________________



Top
#163649 - 2006-06-28 10:30 PM Re: How to use InGroup ???
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
LOL sorry Jochen not meaning to nit-pick just hoping to point out that it reads the SAM database (which contains the info he was looking for) and is not going through the OU structures one by one.

Hopefully the discussion helps all of us to better understand what's going on. Probably only a few geeks on Earth fully understand the whole underlying schema, methodology of AD which leaves most of us to keep struggling with it here and there.

Cheers...

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.079 seconds in which 0.03 seconds were spent on a total of 13 queries. Zlib compression enabled.

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