I have done the same thing with fairly simple code. Here is what I've done:main kix script that gets launched for everyone in the company(there is some other stuff in this script too - ignore it):
law.kix:
----------------------
:RECHECK
$IP=@IPADDRESS0
$LASTIP=readvalue("HKEY_Local_Machine\Software\LAW\IPADDRESS","LASTIP")
if @error<>0 call localdef.kix goto RECHECK endif
if instr("$LASTIP","$IP")=0 call localdef.kix goto RECHECK endif
$HOMESERVER=readvalue("HKEY_Local_Machine\Software\LAW\HOMESERVER","HOMESERVER")
if @error<>0 call localdef.kix goto RECHECK endif
$LASTY2K=readvalue("HKEY_Local_Machine\Software\LAW\Y2K","Y2KOK")
IF @error=0
IF instr("$LASTY2K","YES")
GOTO SKIPY2KCHECK
ENDIF
ENDIF
call checkie.kix
:SKIPY2KCHECK
if $HOMESERVER="skip" exit endif
run "net time \\$HOMESERVER /set /yes"
SELECT
CASE $HOMESERVER="Atlanta-1"
GOTO NORTONNAVUP
CASE $HOMESERVER="Lawrenceville-1"
GOTO NORTONNAVUP
CASE 1
ENDSELECT
exit
:NORTONNAVUP
run "\\$HOMESERVER\desktop$$\navnet32\navup\navadmin\nav32up.exe \\$HOMESERVER\desktop$$\navnet32\navup\navadmin\navup.nns"
exit
-------------------------
Here is the local definition script (the reason that they are in two files is so that this longer script does not have to be called unless their IP has changed(i.e. a laptop)
localdef.kix
-------------------------
$IP=@IPADDRESS0
$LEN=len("$IP")
$NWA=substr($IP,9,$LEN-8)
$POS=instr($NWA,".")
$NAP=substr($NWA,1,$POS-1)
$NA=ltrim("$NAP")
SELECT
CASE instr("10-11","$NA")>0
$HS="Albany-1"
CASE instr("63-64","$NA")>0
$HS="Asheville-1"
CASE instr("16-17-18-19","$NA")>0
$HS="Atlanta-1"
CASE instr("26-27","$NA")>0
$HS="Austin-1"
CASE instr("30-31","$NA")>0
$HS="Baltimore-1"
CASE instr("38-39","$NA")>0
$HS="Birmingham-1"
CASE instr("72-73","$NA")>0
$HS="Boston-1"
CASE instr("36-37","$NA")>0
$HS="Canton-1"
CASE instr("32-33","$NA")>0
$HS="Charleston-1"
CASE instr("45-46-47","$NA")>0
$HS="Charlotte-1"
CASE instr("65-66","$NA")>0
$HS="Chattanooga-1"
CASE instr("236-237","$NA")>0
$HS="Chicago-1"
CASE instr("246-247","$NA")>0
$HS="Cincinnati-1"
CASE instr("50-51","$NA")>0
$HS="Columbia-1"
CASE instr("187-188-189-190","$NA")>0
$HS="Corporate-1"
CASE instr("54-55","$NA")>0
$HS="Dallas-1"
CASE instr("69-70","$NA")>0
$HS="Ftworth-1"
CASE instr("173-174","$NA")>0
$HS="Gainesville-1"
CASE instr("214-215","$NA")>0
$HS="Greensboro-1"
CASE instr("218-219","$NA")>0
$HS="Greenville-1"
CASE instr("58-59-60-61-62","$NA")>0
$HS="Houston-1"
CASE instr("220-221","$NA")>0
$HS="Jackson-1"
CASE instr("70-71","$NA")>0
$HS="Jacksonville-1"
CASE instr("74-75-76-77-78-79-80-81-82-83-84-85-86-87-88-89-90-91-92-93-94-95-96-97-98-99","$NA")>0
$HS="Kennesaw-1"
CASE instr("234-235","$NA")>0
$HS="Knoxville-1"
CASE instr("14-15","$NA")>0
$HS="Lawrenceville-1"
CASE instr("248-249","$NA")>0
$HS="Lexington-1"
CASE instr("122-123-124-125-126-127","$NA")>0
$HS="Losangeles-1"
CASE instr("134-135-136-137","$NA")>0
$HS="Louisville-1"
CASE instr("142-143","$NA")>0
$HS="Miami-1"
CASE instr("40-41","$NA")>0
$HS="Milwaukee-1"
CASE instr("240-241","$NA")>0
$HS="Naples-1"
CASE instr("144-145","$NA")>0
$HS="Nashville-1"
CASE instr("150-151","$NA")>0
$HS="Newyork-1"
CASE instr("154-155","$NA")>0
$HS="Norfolk-1"
CASE instr("162-163","$NA")>0
$HS="Orlando-1"
CASE instr("34-35","$NA")>0
$HS="Beltsville-1"
CASE instr("170-171-172","$NA")>0
$HS="Phoenix-1"
CASE instr("178-179","$NA")>0
$HS="Raleigh-1"
CASE instr("156-157","$NA")>0
$HS="Richmond-1"
CASE instr("202-203","$NA")>0
$HS="Sandiego-1"
CASE instr("160-161","$NA")>0
$HS="SanJuan-1"
CASE instr("164-165","$NA")>0
$HS="Savannah-1"
CASE instr("222-223-224-225","$NA")>0
$HS="Tampa-1"
CASE instr("28-29","$NA")>0
$HS="Tulsa-1"
CASE instr("230-231-232-233","$NA")>0
$HS="Washington-1"
CASE instr("67-68","$NA")>0
$HS="Westpalm-1"
CASE instr("244-245","$NA")>0
$HS="Wilmington-1"
CASE 1
$HS="skip"
MESSAGEBOX("This Login Script was not able to determine your Home Server. Please contact Helpdesk and let them know that you got this message. Your virus definitions and engine will not be updated until this is resolved.","Login Script Error - 'Can Not Determine Home Server'",16)
ENDSELECT
$HOMESERVER=$HS
$RC=existkey("HKEY_Local_Machine\Software\LAW")
if $RC<>0 Addkey("HKEY_Local_Machine\Software\LAW") endif
$RC=existkey("HKEY_Local_Machine\Software\LAW\HOMESERVER")
if $RC<>0 Addkey("HKEY_Local_Machine\Software\LAW\HOMESERVER")
WRITEVALUE("HKEY_Local_Machine\Software\LAW\HOMESERVER","HOMESERVER","$HOMESERVER","REG_SZ")
$RC=existkey("HKEY_Local_Machine\Software\LAW\IPADDRESS")
if $RC<>0 Addkey("HKEY_Local_Machine\Software\LAW\IPADDRESS")
WRITEVALUE("HKEY_Local_Machine\Software\LAW\IPADDRESS","LASTIP","$IP","REG_SZ")
return
-------------------------
So what I'm basically doing here, is keeping the main script very short (to improve time). I am also using the registry to cache values so that I can keep from calling up the longer scripts unless they really are needed to be pulled up. I know that there is a lot here, so if you need more explanation then I'll explain better. Sorry that there are not any comments in the script. Every byte counts over a slow wan link!
------------------
Gary Siepser, MCSE
LAWGIbb Group, Inc.
gsiepser@lawco.com