Page 1 of 1 1
Topic Options
#61797 - 2002-01-03 12:06 AM Enumgroup question..
Anonymous
Unregistered


Hi All!
Hope that you had a nice new years eve.

I don't know if this is the function I should use or not, but here goes....

I have a NT4 domain, with ALOT of global groups (to many, but the old admin...).
I need to map a folder depending on witch group the user is in.
(so far that's not the problem).
ALL groupīnames looks like this:
xxxInl
Where "xxx" can be:
aaa, aab, abc, 94a, 95f, etc,etc.

The mapping I need to do is based on the first 3 letters of the groupname.

Anyone that can point me in the right direction?

regards
Frippe

Top
#61798 - 2002-01-03 12:16 AM Re: Enumgroup question..
Anonymous
Unregistered


Hi,

you need to use the ingroup("groupname") function

happy new year

Alex T

Top
#61799 - 2002-01-02 02:04 PM Re: Enumgroup question..
Anonymous
Unregistered


If I use the "Ingroup" function, I would have to do the following:

IF Ingroup("aaaInl") use x: \\Server\aaa
EndIF
IF Ingroup("aabInl") use x: \\Server\aab
EndIF
IF Ingroup("abcInl") use x: \\Server\abc
EndIF
IF Ingroup("95fInl") use x: \\Server\95f
EndIF

That would make my loginscript very loooong.

What I was thinking was something like this:

$Group=""
"if user is in a group that ends with INL, then set $Group to the 3 letters before INL"
use x: \\Server\$Group

What I'm missing is the code that does the things in the quoted line.

Makes this any sense??
Frippe

Top
#61800 - 2002-01-02 02:23 PM Re: Enumgroup question..
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you need to anyhow spell every groupname in your scripts.
if you are using kix 2001 it can be done like this:

code:

$groups = aaaINL,adcINL,1dsINL ;and so on
for each $group in $groups
if ingroup("$group")
use x: "\\server\"+substr("$group",1,3)
endif
next

it's been a while for me (6months) when I last have been scripting with arrays, but something like this should work.
so for every group, you only need to add the groupname to the end of the groups-array.

hope this helpes.

_________________________
!

download KiXnet

Top
#61801 - 2002-01-04 12:16 AM Re: Enumgroup question..
TrentL Offline
Fresh Scripter

Registered: 2002-01-02
Posts: 11
Loc: Canada
;standard drive mappings
Use g: "\\carefs01\team"
use m: "\\carefs01\apps"
use u: "\\carefs01\cldata"

;Map any BU specific drive mappings and run any application batch files.
$n = 0
do
$grp = enumgroup($n)
Select
Case instr($grp, "$CP")
use n: /delete
use n: "\\catofs03\cpdata"
use s: /delete
use s: "\\carefs01\CPDATA"
call $logonpath + "\regina\scripts\toronto.kix"
call $logonpath + "\regina\scripts\corp.kix"
exit

Case instr($grp, "$GP")
use s: /delete
use s: "\\carefs01\GPDATA"
call $logonpath + "\regina\scripts\glh.kix"
exit

Case instr($grp, "$ID")
use s: /delete
use s: "\\carefs01\IDDATA"
call $logonpath + "\regina\scripts\indiv.kix"
exit

Case instr($grp, "$IP")
use s: /delete
use s: "\\carefs01\IPDATA"
exit

Case instr($grp, "$RI")
use s: /delete
use s: "\\carefs01\RIDATA"
call $logonpath + "\regina\scripts\react.kix"
exit

endselect
$n = $n + 1
until $grp = ""


The above script is what I use to map drives (I think it is what you are after). My problem is that the command enumgroup takes about 15seconds to run. Does anyone know a way of speeding this up.

Thanks,
Trent

Top
#61802 - 2002-01-04 01:33 AM Re: Enumgroup question..
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
Difficult to speed it, as kix need to parse all groups of the user
Maybe kixtart 4.01 is much faster (don't really test it)
Kixtart 4.02 will be, but you'll have to wait

On the other hand, i suggest you something that i'm currently trying : multithreading (Yes guys, i'm getting to be a real maniac with Kix)
This is only if you can split your script in standalone parts.
In the main script, start other you want to get fasters with this command :

code:

$ScriptToRun="complete_path\script.kix"
$Kix32exe="Complete_path\Kix32.exe"
Shell "Start /m "+ $Kix32exe+" "+ $ScriptToRun


(/m is here for minimized state)
With this, the script you ran will be executed on a different process. I found it better with network connection when "Net use" are slow. Maybe it can be of some help with Enumgroup()
Also, beware as this method can have unsuspected results when errors occurs, as the user may won't see the possible errors and the script won't be in the logon process, so logon won't wait for it's end before showing the user desktop.

[ 04 January 2002: Message edited by: Alex.H ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#61803 - 2002-01-04 01:54 AM Re: Enumgroup question..
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
How about using the right() function
code:

$Check = right($groupname,3)
use x: \\Server\$check

_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#61804 - 2002-01-07 11:03 AM Re: Enumgroup question..
Anonymous
Unregistered


Thanks Guys!!
Finally I solved this...

This is what I did:

code:

$index = 0
Do
$group = Enumgroup($index)
$index = $index + 1
IF INSTR($group,"Inl")
$Hoger = RIGHT($group,10)
IF INSTR($Hoger,"ola")
$Trim = RIGHT($Hoger,6)
$Resultat = LEFT($Trim,3)
ELSE
$Resultat = LEFT($Hoger,3)
ENDIF
ENDIF
Until Len($Group) = 0
Use x: \\Server\$Resultat

I don't know if it's possible to optimize this, but it works as it is.

regards
Frippe

[ 07 January 2002: Message edited by: Frippe ]

Top
Page 1 of 1 1


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

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

Generated in 0.06 seconds in which 0.03 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