Page 1 of 1 1
Topic Options
#119689 - 2004-05-17 05:02 PM Having problems mapping drives based on Group
EddieG Offline
Lurker

Registered: 2004-05-17
Posts: 1
I am having problems using Kix32 when trying to map drives based on group membership. I am really not very knowledgable on scripting so I apologize for my ignorance in advance. Below is the script i am trying to use (real names have been omitted for security reasons.


IF INGROUP("Group1")
USE J: "\\Server\Share1"
ENDIF
GOTO "SECTION2"

:SECTION2
IF INGROUP("Group2")
USE f: "\\Server\Share2"
USE g: "\\Server\Share3$"
ENDIF
GOTO "SECTION3"

:SECTION3
IF INGROUP("Group3")
USE m: "\\Server\Share4"
ENDIF
GOTO "END"

:END
EXIT

The first drive gets mapped, but nothing else does. I am sure it is something stupid but I can't figure it out. Your help is much appreciated. Thanks.

Top
#119690 - 2004-05-17 05:20 PM Re: Having problems mapping drives based on Group
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Lose the GOTOs.

Remove existing mappings so you are clear to add the new ones.

Add comments, so that you know it is actually attempting the mappings.

Add error checking, to display the reason the mapping failed.

Abstract the mappings to a UDF (or use one from our UDF library) so that you don't keep writing the same code over and over again.

Something like this (not tested):
Code:
If InGroup("Group1")
MapDrive("J:","\\Server\Share1")
EndIf

If InGroup("Group2")
MapDrive("f:","\\Server\Share2")
MapDrive("g:","\\Server\Share3$")
EndIf

If InGroup("Group3")
MapDrive("m:","\\Server\Share4")
EndIf

Exit 0

Function MapDrive($d,$p)
"Mapping drive "+$d+" to "+$p+"..."
Use $d /delete /persistent
Use $d $p
If @ERROR
" ***ERROR***"+@CRLF
" "+@ERROR+" / "+@SERROR+@CRLF
Else
" Ok."+@CRLF
EndIf
EndFunction


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 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.049 seconds in which 0.024 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