#28785 - 2002-09-10 07:11 PM
InGroup (script only works for the very first group in the script)
|
Wolven
Fresh Scripter
Registered: 2002-09-10
Posts: 8
|
Hey guys, I have generated a login script that takes advantage of the "InGroup" feature. But my login script only works for the very first group in the script. To get the script to map drives according to the group I have to move that group to the top of the script, subsequently the other group mappings fail. No error message.
Has anyone seen this before?
(MCA: extend subject) [ 05. December 2002, 01:17: Message edited by: MCA ]
|
|
Top
|
|
|
|
#28787 - 2002-09-10 07:18 PM
Re: InGroup (script only works for the very first group in the script)
|
Wolven
Fresh Scripter
Registered: 2002-09-10
Posts: 8
|
Additional Information: Windows NT environment, Clients are 9x-2k. The script is simply exiting before the entire script has run.
|
|
Top
|
|
|
|
#28788 - 2002-09-10 07:21 PM
Re: InGroup (script only works for the very first group in the script)
|
Wolven
Fresh Scripter
Registered: 2002-09-10
Posts: 8
|
Thanks for the response Shawn. Just using the "IF" statement. Here is a sample of my code:
code:
$Drive="f" $Share="\\darla\statements"
If InGroup (HOUBANK)
If InGroup ("HOUBANK") ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIf
$Drive="j" $Share="\\darla\HOUBANK"
If InGroup ("HOUBANK") ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIf
$Drive="r" $Share="\\buckwheat\ri"
If InGroup ("HOUBANK") ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIf
$Drive="f" $SHARE="\\darla\statements"
If InGroup (Accounting)
; input time synchronization command If InGroup("accounting") ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIf
$Drive="k" $Share="\\darla\cos"
If InGroup("accounting") ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIf
$Drive="l" $Share="\\darla\data"
If InGroup("accounting") ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIf
$Drive="s" $Share="\\stymie\Program Files"
If InGroup("accounting") ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIf
This is replicated on down for each department respectively.
Thanks for the help
(MCA: correct layout) [ 05. December 2002, 01:20: Message edited by: MCA ]
|
|
Top
|
|
|
|
#28790 - 2002-09-10 07:46 PM
Re: InGroup (script only works for the very first group in the script)
|
Wolven
Fresh Scripter
Registered: 2002-09-10
Posts: 8
|
Thanks for the input Sealeopold, I tried your suggestions and I get the same result. KIX2001.DOC, Kixtart.chm have very limited information on the "InGroup" feature from what I could search on. Bear in mind, that if I move any of the groups my test user is a member of to the top of the script then the drive mappings will work.
Thanks.
|
|
Top
|
|
|
|
#28792 - 2002-09-10 09:21 PM
Re: InGroup (script only works for the very first group in the script)
|
Wolven
Fresh Scripter
Registered: 2002-09-10
Posts: 8
|
Hey Thanks to you both, I figured it out from both of your inputs. Correct Syntax below:
code:
SELECT CASE InGroup("Group") $Drive="drive letter" $SHARE="\\servername\share" ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIF $Drive="drive letter" $Share="\\servername\share" ? "Mapping drive $Drive to $Share" Use "$Drive:" /Delete Use "$Drive:" $Share If @error = 0 ? " Map Successful" eLSE ? " Error mapping drive $Drive to $Share" EndIF ENDSELECT
FYI for other novices; Each "GROUP" must have only a single CASE statement following the SELECT statemet with all the subsequent drive mappings underneath. Only use the "ENDSELECT" statement at the very end of your script.
Once Again, Thanks to All!
{edit} Bullock - added code tags. [ 10. September 2002, 21:35: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#28793 - 2002-09-10 09:41 PM
Re: InGroup (script only works for the very first group in the script)
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Wolven, for a script that maps multiple drives, you may want to investigate a UDF to make adding mappings easier.
MapDrive("h:", "MyFileServer", "MyShareName")
code:
Function MapDrive($Drive, $Server, $Share) Dim $Drive, $Server, $Share Color c+/n If $Drive<>"" and $Server<>"" and $Share<>"" $LogText="Connecting $Drive to \\$Server\$Share" ? $LogText USE $Drive /Delete /Persistent USE $Drive "\\$Server\$Share" If @error=0 color g+/n $x=" - Success" "$x" Else color r+/n $x=" - Failed: Error @error" "$x" $ErrorState=1 Endif ;WriteLog ($LogText + $x) ;UDF in UDF Library Color w+/n Else ;UDF in UDF Library ;WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'") Endif Endfunction
|
|
Top
|
|
|
|
#28795 - 2002-12-05 01:16 AM
Re: InGroup (script only works for the very first group in the script)
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
With our tool kixstrip you can verify your script. With the call kixstrip input.kix output.kix /block_check we get
code:
$drive="f" $share="\\darla\statements"
IF InGroup (houbank)
IF InGroup ("HOUBANK") ? "Mapping drive $Drive to $Share" USE "$Drive:" /delete USE "$Drive:" $share IF @error = 0 ? " Map Successful" ELSE ? " Error mapping drive $Drive to $Share" ENDIF
$drive="j" $share="\\darla\HOUBANK"
IF InGroup ("HOUBANK") ? "Mapping drive $Drive to $Share" USE "$Drive:" /delete USE "$Drive:" $share IF @error = 0 ? " Map Successful" ELSE ? " Error mapping drive $Drive to $Share" ENDIF
$drive="r" $share="\\buckwheat\ri"
IF InGroup ("HOUBANK") ? "Mapping drive $Drive to $Share" USE "$Drive:" /delete USE "$Drive:" $share IF @error = 0 ? " Map Successful" ELSE ? " Error mapping drive $Drive to $Share" ENDIF
$drive="f" $share="\\darla\statements"
IF InGroup (accounting)
; input time synchronization command IF InGroup("accounting") ? "Mapping drive $Drive to $Share" USE "$Drive:" /delete USE "$Drive:" $share IF @error = 0 ? " Map Successful" ELSE ? " Error mapping drive $Drive to $Share" ENDIF
$drive="k" $share="\\darla\cos"
IF InGroup("accounting") ? "Mapping drive $Drive to $Share" USE "$Drive:" /delete USE "$Drive:" $share IF @error = 0 ? " Map Successful" ELSE ? " Error mapping drive $Drive to $Share" ENDIF
$drive="l" $share="\\darla\data"
IF InGroup("accounting") ? "Mapping drive $Drive to $Share" USE "$Drive:" /delete USE "$Drive:" $share IF @error = 0 ? " Map Successful" ELSE ? " Error mapping drive $Drive to $Share" ENDIF
$drive="s" $share="\\stymie\Program Files"
IF InGroup("accounting") ? "Mapping drive $Drive to $Share" USE "$Drive:" /delete USE "$Drive:" $share IF @error = 0 ? " Map Successful" ELSE ? " Error mapping drive $Drive to $Share" ENDIF
;($begin) ; ; thu 05-dec-2002 01:17:51 (kix 4.10 vs 3.20e) ; ;Informative KIXSTRIP: input=95 output=95 skip=0 ; ;Warning KIXSTRIP: 9 errors in block structure(s). missing statement(s). ; - do:until [0:0] ; - for|each:in|to:step|next [0|0:0|0:0|0] ; - function:endfunction [0:0] ; -ERROR- - if:else:endif [16:7:7] ; - select:case:endselect [0:0:0] ; - while:loop [0:0] ;Warning KIXSTRIP: some lines contains errors or possible errors. ;Informative KIXSTRIP: 16 block_structures found. ;Informative KIXSTRIP: no UDF's found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 14 USE ; ;($end) ;($begin) ; ; ;($end)
greetings.
|
|
Top
|
|
|
|
#28797 - 2002-12-05 01:47 AM
Re: InGroup (script only works for the very first group in the script)
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Lonkero,
For us it is very easy to find an older one. Examples of them are F1-1 and F2-1. Only we are searching at this moment for topics, which doesn't have all answers for the question in it and which answer can more complete with additional information. In this case readers/members doesn't need first to download our tool to see possibilities. greetings. greetings.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 885 anonymous users online.
|
|
|