#177649 - 2007-07-09 01:08 PM
Connect other share if member of more than 1 group
|
BunzyBuddy
Fresh Scripter
Registered: 2006-02-22
Posts: 40
Loc: Amsterdam, Holland
|
Hi all,
I'm willing to connect a network drive to a server share if the user is member of a certain domain group. Of course this is easy using IF INGROUP.... etc. But, how can I verify if an user is member of more than 1 of predefined groups and, if so, connect him to another location or share ?
Please help ???
Job van Dalen
|
|
Top
|
|
|
|
#177650 - 2007-07-09 01:19 PM
Re: Connect other share if member of more than 1 group
[Re: BunzyBuddy]
|
Björn
Korg Regular
   
Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
|
Hi, it states how to in the command reference:
Example
IF INGROUP("Domain Users")
DISPLAY "z:\users.txt"
ENDIF
IF INGROUP("Developers", "Testers") = 1
? "Member of Developers OR Testers group"
ENDIF
IF INGROUP("Developers", "Testers", 1) = 1
? "Member of Developers AND Testers group"
ENDIF
$Array = "Developers", "Testers"
IF INGROUP($Array, 1) = 1
? "Member of Developers AND Testers group"
ENDIF
IF INGROUP("\\" + @WKSTA + "\Developers") = 1
? "Member of Developers on local system"
ENDIF
INGROUP ("group name" [<,> "group name 2"], Mode)
Parameter
Group name1, group name 2, group name …
Identifies the group(s) in which to check the user's membership.
Multiple group names may be passed as arguments. Alternatively,
you may specify a single, one-dimensional, array of which the element(s) are the names of one or more groups to test.
Mode
Optional integer parameter indicating whether or not Ingroup checks for
groupmembership of one or all groups in the list (default = 0).
Possible values:
0
Ingroup checks for membership of ONE of the groups in the list (default).
1
Ingroup checks for membership of ALL of the groups in the list.
Remarks
INGROUP can be used to check for group membership of groups that exist on
the domain or server where the user is logged on, or to check for group
membership of groups on a specific domain or server.
When checking for a local group, INGROUP identifies that the user is indirectly a member of the group by virtue of being a member of a global
group which, in turn, is a member of the local group.
Edited by Björn (2007-07-09 01:30 PM)
|
|
Top
|
|
|
|
#177651 - 2007-07-09 01:39 PM
Re: Connect other share if member of more than 1 group
[Re: Björn]
|
BunzyBuddy
Fresh Scripter
Registered: 2006-02-22
Posts: 40
Loc: Amsterdam, Holland
|
Thanx for all replies. Your examples are (as far as I understand) OR member of 1 of selected groups OR member of ALL selected groups. What I want to do is checking if user is member of MORE THAN ONE of the selected groups (2, 3 or 4)
Is that possible ?
|
|
Top
|
|
|
|
#177653 - 2007-07-09 02:03 PM
Re: Connect other share if member of more than 1 group
[Re: Björn]
|
BunzyBuddy
Fresh Scripter
Registered: 2006-02-22
Posts: 40
Loc: Amsterdam, Holland
|
this is my situation:
ROOT | -------------------------------- | | | | Dir1 Dir2 Dir3 Dir4
If user is member of Group_Dir1, his drive would be connected to \\Server\Dir1 If user is member of Group_Dir2, his drive would be connected to \\Server\Dir2 And so on....
But, if user is member of more than one group, lets say he's member of Group_Dir1 and Group_Dir3, his drive has to be connected to the root: \\Server\Root
|
|
Top
|
|
|
|
#177655 - 2007-07-09 02:37 PM
Re: Connect other share if member of more than 1 group
[Re: BunzyBuddy]
|
Björn
Korg Regular
   
Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
|
I have something you might could use at home - using an ini, but given the critera right now, and if you know that this will only occur once or twice you could try this (just something simple): Note- This is not tested in anyway more then with eyesight, and I am not wearing my glasses 
If INGROUP("Group_Dir1","Group_Dir3",1)
use X: "\\server\root"
Else
Select
case INGROUP("Group_Dir1")
use x: "\\server\dir1"
case INGROUP("Group_Dir2")
use x: "\\server\dir2"
case 1
;something default..
EndSelect
EndIf
Looks like Glenn beat me to it
Edited by Björn (2007-07-09 02:53 PM) Edit Reason: added warning-note
|
|
Top
|
|
|
|
#177661 - 2007-07-09 02:57 PM
Re: Connect other share if member of more than 1 group
[Re: Glenn Barnas]
|
BunzyBuddy
Fresh Scripter
Registered: 2006-02-22
Posts: 40
Loc: Amsterdam, Holland
|
Thanx Bjorn, thanx Glenn, this is exacly what I needed.
|
|
Top
|
|
|
|
#177664 - 2007-07-09 03:08 PM
Re: Connect other share if member of more than 1 group
[Re: Björn]
|
BunzyBuddy
Fresh Scripter
Registered: 2006-02-22
Posts: 40
Loc: Amsterdam, Holland
|
No problem Bjorn. Thanx for your help. Do you realy think there's an error in Glenn's code ?
|
|
Top
|
|
|
|
#177666 - 2007-07-09 04:02 PM
Re: Connect other share if member of more than 1 group
[Re: Glenn Barnas]
|
BunzyBuddy
Fresh Scripter
Registered: 2006-02-22
Posts: 40
Loc: Amsterdam, Holland
|
Haha, thanx Glenn !
|
|
Top
|
|
|
|
#177667 - 2007-07-09 04:10 PM
Re: Connect other share if member of more than 1 group
[Re: BunzyBuddy]
|
BunzyBuddy
Fresh Scripter
Registered: 2006-02-22
Posts: 40
Loc: Amsterdam, Holland
|
Whell, after having corrected some typing-errors, your script does exactly wat I was looking for ! I'm very happy !! Thanx again !
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|