Hello,
I am new to KiXtart and ready to replace the existing "netlogon.cmd" with
my first KiXtart-script. It might not look so good, but it works (somehow).
Short overwiew:
/* Server */ --> Create var for the servers.
/* Mappings */ --> Create var for "usergroups" ($MAP_USER) "Server+Share" ($MAP_Server),
"drive" ($MAP_LW) and "userparameters" ($MAP_USP)
/* Execute */ --> to combine the var from /* Mapping */ into commands
The Code-segment below is cut short
Code:
/* Server */
$fileserver="myfileserver"
$baan3="mybaanserver"
/* Mappings */
$MAP_User_220="domain\usergroup-all"
$MAP_Server_220="$fileserver\group"
$MAP_LW_220="G:"
$MAP_USER_221="domain\usergroup-all"
$MAP_SERVER_221="$fileserver\home\@USERID"
$MAP_LW_221="H:"
; etc.
$MAP_USER_230="domain\usergroup-itadm"
$MAP_SERVER_230="$baan3\it"
$MAP_LW_230="S:"
$MAP_USP_230="/user:itadm"
/* Execute */
IF INGROUP ($MAP_USER_220) = 1
? "connect $MAP_LW_220 " shell "net use " + $MAP_LW_220 + " \\$MAP_Server_220 " + $MAP_USP_220
ENDIF
IF INGROUP ($MAP_USER_221) = 1
? "connect $MAP_LW_221 " shell "net use " + $MAP_LW_221 + " \\$MAP_Server_221 " + $MAP_USP_221
ENDIF
; etc.
This works fine, but for every new networkshare (i.e. no.231) I have to create 3-4 entries in /* Mappings */, each with 231
and an entry in /* Execute */ with all 231 to map it.
As I tried to make everything a var, I would like to use in /* Execute */ only ONE loop instead, like:
For $count = 220 to 230 step 1
IF INGROUP ($MAP_USER_XXX) = 1
? "connect $MAP_LW_XXX " shell "net use " + $MAP_LW_XXX + " \\$MAP_Server_XXX " + $MAP_USP_XXX
ENDIF
NEXT
"XXX" should be increased every step and refer back to the vars in /* Mappings */
So people will only have to add new mappings in /* Mappings */ and raise the
loop counter "to 232" and the skript does the rest itself in the loop.
10 possible Mappings --> 1 Loop
250 possible Mappings --> still 1 loop, but more vars in /* Mappings */
Is this somehow possible?
I tried to include $count instead of "XXX", added (, " and +
I tried to slpit the vars in an array, join them back, but I never got the loop
to use the vars from /* Mappings */. It alway used the vars as strings or not at all.
Any ideas, comments or commands?
Regards,
Carsten