Wadoki
(Fresh Scripter)
2002-04-03 04:01 PM
Please Help to debug my script

Below is the script I am using. I am very new to scripting so i'm sure there are much better ways then this, but I have a problem. The script should:

1. Toss up a box with some info (works OK)
2. Run an inventory program (works OK)
3. Adds user info to MS Office (works OK)
4. Checks and copies kixtart files to the local PC (works OK)
5. Removes Network drives (works OK)
6. Maps a G: Drive for all users (works OK)
7. Does individual customization. It should install a printer or two and Map a personal folder. A F: Drive. The printers are going in OK, but the drive mapping for the individuls does not work....What am I doing wrong.

Plus sometimes the info window does not go away or alow you to close it. I have to use the task manager to do it.

code:
 
;
CLS

small
Color b+/n
BOX (0,0,24,79,GRID) ; 'background grid'
Color b/n
BOX (8,21,18,61,Å) ; 'shadow' of the box
Color g+/n
BOX (7,20,17,60,FULL)

Color w+/n
AT ( 9,25) "Userid : " ; display some text strings
AT (10,25) "Full name : "
AT (11,25) "Privilege : "
AT (12,25) "Workstation : "
AT (13,25) "Domain : "
AT (14,25) "Logon Server : "

Color y+/n
AT ( 9,40) @userid ; ...and some macro's
AT (10,40) @fullname
AT (11,40) @priv
AT (12,40) @wksta
AT (13,40) @domain
AT (14,40) @lserver

SLEEP 2
;
; *********************************************
; *** To Install ZAC 2001
; *********************************************
;
Run "\\w20lan03\sys\siteinv\agent\equipldr.exe /noshow"
;
;
; * Update MS Office 8.0 or 9.0's Common UserInfo [Begin] *
; The MS Word UserInfo is stored in the registry as Unicode.
; This routine basically interleaves the strings with 00's
; simulating the Unicode equivalent of US-English.
; ** Do not use this routine on localized OS versions other than US-English. **
; The User's Full Name will be extracted from UMD.
; The User's (3) Initials will be extracted from UMD's Description Field,
; provided they are preceded with a pound symbol somewhere in the Desccription
; field. Example of Description Field in UMD: [Network Administrator #ABC ]
; The User's Company needs to be supplied on the next line.
$Company='Winpak Films Inc.'
if existkey('$HKCUSM\Office')=0
$x=1
$RegExp=''
while $X<len(''+$Company)+1
$RegExp=$RegExp+dectohex(asc(substr($Company,$x,1)))+'00'
$x=$x+1
loop
$RegExp=$RegExp+'0000'
$RegKey='$HKCUSM\Office\9.0\Common\UserInfo' ; Office 2000
if existkey('$RegKey')=0
$result=writevalue('$RegKey','Company','$RegExp','REG_BINARY')
endif
$RegKey='$HKCUSM\Office\8.0\Common\UserInfo' ; Office 97
if existkey('$RegKey')=0
$result=writevalue('$RegKey','Company','$RegExp','REG_BINARY')
endif
$x=1
$RegExp=''
while $X<len(''+$FullName)+1
$RegExp=$RegExp+dectohex(asc(substr($FullName,$x,1)))+'00'
$x=$x+1
loop
$RegExp=$RegExp+'0000'
$RegKey='$HKCUSM\Office\9.0\Common\UserInfo' ; Office 2000
if existkey('$RegKey')=0
$result=writevalue('$RegKey','UserName','$RegExp','REG_BINARY')
endif
$RegKey='$HKCUSM\Office\8.0\Common\UserInfo' ; Office 97
if existkey('$RegKey')=0
$result=writevalue('$RegKey','UserName','$RegExp','REG_BINARY')
endif
if $Initials
$x=1
$RegExp=''
while $X<len(''+$Initials)+1
$RegExp=$RegExp+dectohex(asc(substr($Initials,$x,1)))+'00'
$x=$x+1
loop
$RegExp=$RegExp+'0000'
$RegKey='$HKCUSM\Office\9.0\Common\UserInfo' ; Office 2000
if existkey('$RegKey')=0
$result=writevalue('$RegKey','UserInitials','$RegExp','REG_BINARY')
endif
$RegKey='$HKCUSM\Office\8.0\Common\UserInfo' ; Office 97
if existkey('$RegKey')=0
$result=writevalue('$RegKey','UserInitials','$RegExp','REG_BINARY')
endif
endif
endif
;
; * Update MS Office 8.0 or 9.0's Common UserInfo [End] *
;
; *********************************************
; *** Check for KixTart
; *********************************************
;
If @INWIN=1
If NOT Exist ("c:\winNT\kix32.exe") Copy @lserver+"\netlogon\kix32.exe" "c:\winNT" EndIf
If NOT Exist ("c:\winNT\kxrpc.exe") Copy @lserver+"\netlogon\kxrpc.exe" "c:\winNT" EndIf
If NOT Exist ("c:\winNT\system32\kx16.dll") Copy @lserver+"\netlogon\kx16.dll" "c:\windows\system32" EndIf
If NOT Exist ("c:\winNT\system32\kx32.dll") Copy @lserver+"\netlogon\kx32.dll" "c:\windows\system32" EndIf
If NOT Exist ("c:\winNT\system32\kx95.dll") Copy @lserver+"\netlogon\kx95.dll" "c:\windows\system32" EndIf
EndIf
;
If @INWIN=2
If NOT Exist ("c:\windows\kix32.exe") Copy @lserver+"\netlogon\kix32.exe" "c:\windows\kix32.exe"EndIf
If NOT Exist ("c:\windows\kxrpc.exe") Copy @lserver+"\netlogon\kxrpc.exe" "c:\windows" EndIf
If NOT Exist ("c:\windows\system\kx16.dll") Copy @lserver+"\netlogon\kx16.dll" "c:\windows\system" EndIf
If NOT Exist ("c:\windows\system\kx32.dll") Copy @lserver+"\netlogon\kx32.dll" "c:\windows\system" EndIf
If NOT Exist ("c:\windows\system\kx95.dll") Copy @lserver+"\netlogon\kx95.dll" "c:\windows\system" EndIf
EndIf
;
; *********************************************
; *** Delete network-drives
; *********************************************
;
;Use * /Delete /Persistent
;
; *********************************************
; *** Begin Group Drive Mapping
; *********************************************

USE F: "\\w20lan01\Groups"

; *********************************************
; *** Begin User Customization
; *********************************************

IF %USERNAME% = "w20acdnt" ; ...Don Thompson
USE G: "\\W20LAN01\Don"
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20acct") =0
ENDIF
;
IF %USERNAME% = "w20acggm" ; ...Greg Morgan
USE G: "\\W20LAN01\Morgan"
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20acct") =0
ENDIF
;
IF %USERNAME% = "w20aclic" ; ...Lori Chilton
USE G: "\\W20LAN01\Chilton"
ADDPRINTERCONNECTION ("\\w20lan04\w20pay")
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20pay") =0
ENDIF
;
IF %USERNAME% = "w20acpah" ; ...Patricia Hurst
USE G: "\\W20LAN01\Hurst"
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20acct") =0
ENDIF
;
IF %USERNAME% = "w20acpkm" ; ...Patrick McGlade
USE G: "\\W20LAN01\McGlade"
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20acct") =0
ENDIF
;
IF %USERNAME% = "w20acsne" ; ...Sharon Eller
USE G: "\\W20LAN01\Eller"
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20acct") =0
ENDIF
;
IF %USERNAME% = "w20adayt" ; ...Amy Tollison
USE G: "\\W20LAN01\Tollison"
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20sales") =0
ENDIF
;
IF %USERNAME% = "w20addjm" ; ...David Mosgrove
USE G: "\\W20LAN01\Mosgrove"
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20east-1") =0
ENDIF
;
IF %USERNAME% = "w20adeep" ; ...Emilie Pelfrene
USE G: "\\W20LAN01\Pelfrene"
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20sales") =0
ENDIF
;
IF %USERNAME% = "w20adkmb" ; ...Kevin Byers
USE G: "\\W20LAN01\Byers"
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
SetDefaultPrinter ("\\w20lan04\w20sales") =0
ENDIF
;
IF %USERNAME% = "w20csans" ; ...Ann Stooksbury
USE G: "\\W20LAN01\Users"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20emdsp" ; ...Glenda Scruggs
USE G: "\\W20LAN01\Scruggs"
ADDPRINTERCONNECTION ("\\w20lan04\w20west-1")
SetDefaultPrinter ("\\w20lan04\w20west-1") =0
ENDIF
;
IF %USERNAME% = "w20csilc" ; ...Isobel Charpentier
USE G: "\\W20LAN01\Charpentier"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20csjns" ; ...John Symank
USE G: "\\W20LAN01\Symank"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20cskyo" ; ...Kim O'Neal
USE G: "\\W20LAN01\O'Neal"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20csrar" ; ...Rhonda Rose
USE G: "\\W20LAN01\Rose"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20cssah" ; ...Shea Hatchett
USE G: "\\W20LAN01\Hatchett"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20cssnc" ; ...Stan Cox
USE G: "\\W20LAN01\Cox"
ADDPRINTERCONNECTION ("\\w20lan04\w20west-1")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20west-1") =0
ENDIF
;
IF %USERNAME% = "w20cstit" ; ...Terri Tubens
USE G: "\\W20LAN01\Tubens"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20emdsp" ; ...Dennis Pontious
USE G: "\\W20LAN01\Users"
USE E: "\\W20LAN03\MP2ACCESS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20emmms" ; ...Marcus Stevens
USE G: "\\W20LAN01\Users"
USE E: "\\W20LAN03\MP2ACCESS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20emtdl" ; ...Todd Lupo
USE G: "\\W20LAN01\Lupo"
USE E: "\\W20LAN03\MP2ACCESS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20hrjhc" ; ...Judith Carr
USE G: "\\W20LAN01\Carr"
ADDPRINTERCONNECTION ("\\w20lan04\w20hr")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20hr") =0
ENDIF
;
IF %USERNAME% = "w20hrlmr" ; ...Lisa Redmon
USE G: "\\W20LAN01\Redmon"
ADDPRINTERCONNECTION ("\\w20lan04\w20hr")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20hr") =0
ENDIF
;
IF %USERNAME% = "w20hrpeb" ; ...Paulette Brown
USE G: "\\W20LAN01\Brown"
ADDPRINTERCONNECTION ("\\w20lan04\w20hr")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20hr") =0
ENDIF
;
IF %USERNAME% = "w20itstd" ; ...Scott Dacus
USE G: "\\W20LAN01\Dacus"
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20acct") =0
ENDIF
;
IF %USERNAME% = "w20maint" ; ...Maintenance
USE G: "\\W20LAN01\USERS
USE E: "\\W20LAN03\MP2ACCESS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20mkdds" ; ...David Soper
USE G: "\\W20LAN01\Soper"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20mkhfc" ; ...Herman Cameron
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20mkpjl" ; ...Paul Loftis
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20mksgk" ; ...Susie Kerce
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20mktaa" ; ...Tricia Adams
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20mktac" ; ...Tom Coleman
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20mktmb" ; ...Tim Bentley
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20mslyr" ; ...Larry Robertson
USE G: "\\W20LAN01\Robertson"
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
ADDPRINTERCONNECTION ("\\w20lan04\w20east-3")
SetDefaultPrinter ("\\w20lan04\w20east-1") =0
ENDIF
;
IF %USERNAME% = "w20pacfb" ; ...Cliff Bowles
USE G: "\\W20LAN01\Bowles"
ADDPRINTERCONNECTION ("\\w20lan04\w20west-2")
SetDefaultPrinter ("\\w20lan04\w20west-2") =0
ENDIF
;
IF %USERNAME% = "w20padeh" ; ...Debbie Haynes
USE G: "\\W20LAN01\Haynes"
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
ADDPRINTERCONNECTION ("\\w20lan04\w20east-2")
SetDefaultPrinter ("\\w20lan04\w20east-1") =0
ENDIF
;
IF %USERNAME% = "w20palab" ; ...LeAnne Bright
USE G: "\\W20LAN01\Bright"
ADDPRINTERCONNECTION ("\\w20lan04\w20west-2")
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
SetDefaultPrinter ("\\w20lan04\w20west-2") =0
ENDIF
;
IF %USERNAME% = "w20paprj" ; ...Peter Jeziorski
USE G: "\\W20LAN01\Jeziorski"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20pavns" ; ...Vern Schmitz
USE G: "\\W20LAN01\Schmitz"
ADDPRINTERCONNECTION ("\\w20lan04\w20west-1")
SetDefaultPrinter ("\\w20lan04\w20west-1") =0
ENDIF
;
IF %USERNAME% = "w20pmanp" ; ...Aaron Pike
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20pmdet" ; ...Doyle Thigpen
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20pmdla" ; ...Daryl Adams
USE G: "\\W20LAN01\Daryl"
ADDPRINTERCONNECTION ("\\w20lan04\w20east-2")
SetDefaultPrinter ("\\w20lan04\w20east-2") =0
ENDIF
;
IF %USERNAME% = "w20pmjec" ; ...Jesse Childree
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20pmjed" ; ...Jose Della Mora
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20east-2")
SetDefaultPrinter ("\\w20lan04\w20east-2") =0
ENDIF
;
IF %USERNAME% = "w20pmjns" ; ...Jonathan Satterfield
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20pmmlr" ; ...Mike Reynolds
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20pmryg" ; ...Rocky Gordy
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20pmsea" ; ...Shane Adams
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20prod" ; ...Production
ADDPRINTERCONNECTION ("\\w20lan04\w20west-2")
SetDefaultPrinter ("\\w20lan04\w20west-2") =0
ENDIF
;
IF %USERNAME% = "w20wprod" ; ...West Production
ADDPRINTERCONNECTION ("\\w20lan04\w20west-2")
SetDefaultPrinter ("\\w20lan04\w20west-2") =0
ENDIF
;
IF %USERNAME% = "w20eprod" ; ...East Production
ADDPRINTERCONNECTION ("\\w20lan04\w20east-2")
SetDefaultPrinter ("\\w20lan04\w20east-2") =0
ENDIF
;
IF %USERNAME% = "w20pubrm" ; ...Billy Mitchem
USE G: "\\W20LAN01\Mitchem"
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
SetDefaultPrinter ("\\w20lan04\w20east-1") =0
ENDIF
;
IF %USERNAME% = "w20puckh" ; ...Chuck Hodges
USE G: "\\W20LAN01\Hodges"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-2")
SetDefaultPrinter ("\\w20lan04\w20maint-2") =0
ENDIF
;
IF %USERNAME% = "w20pukml" ; ...Kym Livingston
USE G: "\\W20LAN01\Livingston"
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
ADDPRINTERCONNECTION ("\\w20lan04\w20east-3")
SetDefaultPrinter ("\\w20lan04\w20east-1") =0
ENDIF
;
IF %USERNAME% = "w20qcedh" ; ...Ed Hindy
USE G: "\\W20LAN01\Hindy"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
ADDPRINTERCONNECTION ("\\w20lan04\w20east-3")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20qcjet" ; ...Joe Thrower
USE G: "\\W20LAN01\Thrower"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20qcjnl" ; ...JoAnn Lord
USE G: "\\W20LAN01\Lord"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20qcjqz" ; ...John Zheng
USE G: "\\W20LAN01\Thrower"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20qcknw" ; ...Kevin Watson
USE G: "\\W20LAN01\Watson"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20qclmk" ; ...Bud Keeler
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20qcmyn" ; ...Mary Lou Nowatzki
USE G: "\\W20LAN01\Nowatzki"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20qcrys" ; ...Ray Shen
USE G: "\\W20LAN01\Shen"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20emdsp" ; ...Steve Brzostowicz
USE G: "\\W20LAN01\Brzostowicz"
ADDPRINTERCONNECTION ("\\w20lan04\w20tech")
SetDefaultPrinter ("\\w20lan04\w20tech") =0
ENDIF
;
IF %USERNAME% = "w20training" ; ...Training
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20training")
SetDefaultPrinter ("\\w20lan04\w20training") =0
ENDIF
;
IF %USERNAME% = "w20trbac" ; ...Barbara Crews
USE G: "\\W20LAN01\Crews"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
;
IF %USERNAME% = "w20trsnc" ; ...Susan Coggin
USE G: "\\W20LAN01\Coggin"
ADDPRINTERCONNECTION ("\\w20lan04\w20ship")
SetDefaultPrinter ("\\w20lan04\w20ship") =0
ENDIF
;
IF %USERNAME% = "w20trtyt" ; ...Tammy Thompson
USE G: "\\W20LAN01\Thompson"
ADDPRINTERCONNECTION ("\\w20lan04\w20ship")
SetDefaultPrinter ("\\w20lan04\w20ship") =0
ENDIF
;
IF %USERNAME% = "w20trwest" ; ...West Shipping
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20ship") =0
ENDIF
;
IF %USERNAME% = "w20treast" ; ...East Shipping
USE G: "\\W20LAN01\USERS"
ADDPRINTERCONNECTION ("\\w20lan04\w20east-1")
SetDefaultPrinter ("\\w20lan04\w20east-1") =0
ENDIF
;
EXIT



ShawnAdministrator
(KiX Supporter)
2002-04-03 04:20 PM
Re: Please Help to debug my script

I would stick some of these right after your USE statement:

?"ERROR @ERROR: @SERROR"

Whats the error code ?

-Shawn


Sealeopard
(KiX Master)
2002-04-03 05:15 PM
Re: Please Help to debug my script

The first thing I noticed is that $HKCUSM is not defined anywhere, I gues you might want to add a line in the beginning of the script $HKCUSM='HKEY_CURRENT_USER\SOFTWARE\Microsoft'

Secondly, if you are running Kixtart fromt he local drive then your Kixtart update part will not work because Kixtart is in use at that moment. It is better to update the Kixtart files from a batch file that is used to call the Kixtart script.

Thirdly, you might want to rewrite your IF -ENDIF routine for the user drive mapping. Since the users are unique yous hould rather use SELECT - CASE - ENDSELECT and also replace %USERNAME% with the build-in Kixtart macro @USERID.
code:
SELECT
CASE @USERID='w20acdnt' ; ...Don Thompson
USE G: '\\W20LAN01\Don'
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
CASE @USERID='w20acggm' ; ...Greg Morgan
USE G: '\\W20LAN01\Morgan'
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
ENDSELECT

I also removed the '=0' after the SetDefaultPrinter and removed the spaces between the AddPrinterConnection commands and the parenthesis. The $retocde prevents the output of the printer mapping return values to the console.

You might also want to think about organizing users into groups and then do the drive and/or priner mappings based on group membership. This should cut down on the number of cases that you will need to check and you won't need to modify your script whenever a user gets added, removed, or changes printers.


MCA
(KiX Supporter)
2002-04-07 01:42 AM
Re: Please Help to debug my script

Dear,

First we subscribe the advices from sealeopard.
Secondly we discover a problem with your quotation. By running our
tool kixstrip400.exe you will get following information.

The call was: kixstrip400 input.kix output.kix /block_check

Output of kixstrip400 tool
code:
 ........
IF %USERNAME% = "w20itstd" ; ...Scott Dacus
USE G: "\\W20LAN01\Dacus"
ADDPRINTERCONNECTION ("\\w20lan04\w20acct")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20acct") =0
ENDIF
;
IF %USERNAME% = "w20maint" ; ...Maintenance
USE G: "\\W20LAN01\USERS
; -------> Warning KIXSTRIP: 306 line incomplete "double quotation".
; -------> Warning KIXSTRIP: 306 line incompleted.
USE E: "\\W20LAN03\MP2ACCESS"
ADDPRINTERCONNECTION ("\\w20lan04\w20maint-1")
SetDefaultPrinter ("\\w20lan04\w20maint-1") =0
ENDIF
;
IF %USERNAME% = "w20mkdds" ; ...David Soper
USE G: "\\W20LAN01\Soper"
ADDPRINTERCONNECTION ("\\w20lan04\w20cust")
ADDPRINTERCONNECTION ("\\w20lan04\w20sales")
SetDefaultPrinter ("\\w20lan04\w20cust") =0
ENDIF
........
EXIT

;($begin)
;
; sat 06-apr-2002 20:25:49 (kix 4.00 vs 3.01e)
;
;Summary KIXSTRIP: block structures
; - do:until [0:0]
; - for|each:in|to:step|next [0|0:0|0:0|0]
; - function:endfunction [0:0]
; - if:else:endif [90:0:90]
; - select:case:endselect [0:0:0]
; - while:loop [3:3]
;Warning KIXSTRIP: 1 line is incompleted.
;Warning KIXSTRIP: some lines contains errors or possible errors.
; 1 line incomplete "double quotation".
; 1 line incompleted.
;Informative KIXSTRIP: 93 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: 1 EXIT
;Informative KIXSTRIP: 1 RUN
;Informative KIXSTRIP: 1 SLEEP
;Informative KIXSTRIP: 65 USE
;
;($end)
;($begin)
;
;Warning KIXSTRIP: 306 line incomplete "double quotation".
;Warning KIXSTRIP: 306 line incompleted.
;
;($end)

Advise to replace use * /delete with
code:
use e: /delete /persistent
use f: /delete /persistent
use g: /delete /persistent

greetings.


Wadoki
(Fresh Scripter)
2002-04-09 07:17 PM
Re: Please Help to debug my script

Thanks for all of your help. I believe that most of my problems have been worked out. I still have issues that after the script runs the pop up window will not go away, nor do you have the ability to close it. You have to go to the task manager to stop it.

Not sure what $HKCUSM is for and why I need to add it to my script. and for that mater how.

Where can I get ahold of the kixtart400 program so I can test my scripts for myself.


JochenAdministrator
(KiX Supporter)
2002-04-09 08:00 PM
Re: Please Help to debug my script

hmm ... in the section you try to update Office's common user info , the section starts with :

code:
 if existkey('$HKCUSM\Office')=0 

as $HKCUSM seems to be not defined anywhere, the if statement always returns 'false' and skips the entire part ...

So as Jens stated correctly you have to say :

code:
 $HKCUSM='HKEY_CURRENT_USER\SOFTWARE\Microsoft'


before the if statement

hte

J.


Kdyer
(KiX Supporter)
2002-04-10 01:14 AM
Re: Please Help to debug my script

Wadoki,

Looking at the sheer volume of this script.. Have you thought about trimming it down to use READPROFILESTRING from INI file?

Just a thought.

- Kent


Wadoki
(Fresh Scripter)
2002-04-10 04:07 PM
Re: Please Help to debug my script

I guess a call to an INI would be fine. But I don't know how.

Wadoki
(Fresh Scripter)
2002-04-10 05:14 PM
Re: Please Help to debug my script

Let me start over. I thought about starting a new thread, but nawww.

Basicly I don't know squat about scripting or programing. I am strictly hardware. So forgive my complete lack of brain power.

I have never run scripts on our network before. I do everyting manually. recently we purchased a inventory package that requires that a script be run and a simple entry added to execute a program and send an inventory. So I am taking the opertunity to try and automate some of the other things I do automaticly.

1. I always map a network drive for everyone to G:\ //w20lan01/groups
2. I map a network drive for everyone's personal files to f:\ //w20lan01/.
3. I install network printers.
4. Run the inventoy program.

One of the problems I have on my network (not the script) is that (I don't know why) I get phontom extra net drives that need to be removed.

I had some other stuff in the script, but I removed it to the bare minimun so it would be easier to troubleshoot.

Several people have mentioned about putting people into groups... well I don't see how that would be possible, (you tell me) because of the individual drive mapping and most persons are in more than one group.

So below is my script. I'm sure it's totaly fubar. Most of the time the drive mapping and printer instalation does not work. Plus the window that pops up stays there and you can only kill it with the task manager.

code:
 
; *********************************************
; *** Put message box on screen
; *********************************************
;
CLS

small
Color b+/n
BOX (0,0,24,79,GRID) ; 'background grid'
Color b/n
BOX (8,21,18,61,Å) ; 'shadow' of the box
Color g+/n
BOX (7,20,17,60,FULL)

Color w+/n
AT ( 9,25) "Userid : " ; display some text strings
AT (10,25) "Full name : "
AT (11,25) "Privilege : "
AT (12,25) "Workstation : "
AT (13,25) "Domain : "
AT (14,25) "Logon Server : "

Color y+/n
AT ( 9,40) @userid ; ...and some macro's
AT (10,40) @fullname
AT (11,40) @priv
AT (12,40) @wksta
AT (13,40) @domain
AT (14,40) @lserver

CLS
;
; *********************************************
; *** Delete network-drives
; *********************************************
;
Use * /Delete /Persistent
;
; *********************************************
; *** Begin Group Drive Mapping
; *********************************************

USE F: "\\w20lan01\Groups"

; *********************************************
; *** Begin User Customization
; *********************************************
SELECT
CASE @USERID='w20acdnt' ; ...Don Thompson
USE G: "\\W20LAN01\Don"
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
CASE @USERID='w20acggm' ; ...Greg Morgan
USE G: "\\W20LAN01\Morgan"
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
CASE @USERID='w20aclic' ; ...Lori Chilton
USE G: "\\W20LAN01\Chilton"
$retcode=AddPrinterConnection('\\w20lan04\w20pay')
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20pay')
CASE @USERID='w20acpah' ; ...Patricia Hurst
USE G: "\\W20LAN01\Hurst"
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
CASE @USERID='w20acpkm' ; ...Patrick McGlade
USE G: "\\W20LAN01\McGlade"
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
CASE @USERID='w20acsne' ; ...Sharon Eller
USE G: "\\W20LAN01\Eller"
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
CASE @USERID='w20adayt' ; ...Amy Tollison
USE G: "\\W20LAN01\Tollison"
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20sales')
CASE @USERID='w20addjm' ; ...David Mosgrove
USE G: "\\W20LAN01\Mosgrove"
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-1')
CASE @USERID='w20adeep' ; ...Emilie Pelfrene
USE G: "\\W20LAN01\Pelfrene"
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20sales')
CASE @USERID='w20adkmb' ; ...Kevin Byers
USE G: "\\W20LAN01\Byers"
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=SetDefaultPrinter('\\w20lan04\w20sales')
CASE @USERID='w20csans' ; ...Ann Stooksbury
USE G: "\\W20LAN01\Users"
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20emdsp' ; ...Glenda Scruggs
USE G: "\\W20LAN01\Scruggs"
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-1')
CASE @USERID='w20csilc' ; ...Isobel Charpentier
USE G: "\\W20LAN01\Charpentier"
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20csjns' ; ...John Symank
USE G: "\\W20LAN01\Symank"
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20cskyo' ; ...Kim O'Neal
USE G: "\\W20LAN01\O'Neal"
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20csrar' ; ...Rhonda Rose
USE G: "\\W20LAN01\Rose"
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20cssah' ; ...Shea Hatchett
USE G: "\\W20LAN01\Hatchett"
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20cssnc' ; ...Stan Cox
USE G: "\\W20LAN01\Cox"
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-1')
CASE @USERID='w20cstit' ; ...Terri Tubens
USE G: "\\W20LAN01\Tubens"
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20emdsp' ; ...Dennis Pontious
USE G: "\\W20LAN01\Pontious"
USE E: "\\W20LAN03\MP2ACCESS"
$retcode=AddPrinterConnection('\\w20lan04\w20maint-1')
$retcode=SetDefaultPrinter('\\w20lan04\w20maint-1')
CASE @USERID='w20emmms' ; ...Marcus Stevens
USE E: "\\W20LAN03\MP2ACCESS"
$retcode=AddPrinterConnection('\\w20lan04\w20maint-1')
$retcode=SetDefaultPrinter('\\w20lan04\w20maint-1')
CASE @USERID='w20emtdl' ; ...Todd Lupo
USE G: "\\W20LAN01\Lupo"
USE E: "\\W20LAN03\MP2ACCESS"
$retcode=AddPrinterConnection('\\w20lan04\w20maint-1')
$retcode=SetDefaultPrinter('\\w20lan04\w20maint-1')
CASE @USERID='w20hrjhc' ; ...Judith Carr
USE G: "\\W20LAN01\Carr"
$retcode=AddPrinterConnection('\\w20lan04\w20hr')
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=SetDefaultPrinter('\\w20lan04\w20hr')
CASE @USERID='w20hrlmr' ; ...Lisa Redmon
USE G: "\\W20LAN01\Redmon"
$retcode=AddPrinterConnection('\\w20lan04\w20hr')
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=SetDefaultPrinter('\\w20lan04\w20hr')
CASE @USERID='w20hrpeb' ; ...Paulette Brown
USE G: "\\W20LAN01\Brown"
$retcode=AddPrinterConnection('\\w20lan04\w20hr')
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=SetDefaultPrinter('\\w20lan04\w20hr')
CASE @USERID='w20itstd' ; ...Scott Dacus
USE G: "\\W20LAN01\Dacus"
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
CASE @USERID='w20maint' ; ...Maintenance
USE E: "\\W20LAN03\MP2ACCESS"
$retcode=AddPrinterConnection('\\w20lan04\w20maint-1')
$retcode=SetDefaultPrinter('\\w20lan04\w20maint-1')
CASE @USERID='w20mkdds' ; ...David Soper
USE G: "\\W20LAN01\Soper"
$retcode=AddPrinterConnection('\\w20lan04\w20acct')
$retcode=AddPrinterConnection('\\w20lan04\w20sales')
$retcode=SetDefaultPrinter('\\w20lan04\w20acct')
CASE @USERID='w20mkhfc' ; ...Herman Cameron
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20mkpjl' ; ...Paul Loftis
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20mksgk' ; ...Susie Kerce
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20mktaa' ; ...Tricia Adams
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20mktac' ; ...Tom Coleman
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20mktmb' ; ...Tim Bentley
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20mslyr' ; ...Larry Robertson
USE G: "\\W20LAN01\Robertson"
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-3')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-1')
CASE @USERID='w20pacfb' ; ...Cliff Bowles
USE G: "\\W20LAN01\Bowles"
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-2')
CASE @USERID='w20padeh' ; ...Debbie Haynes
USE G: "\\W20LAN01\Haynes"
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-1')
CASE @USERID='w20palab' ; ...LeAnne Bright
USE G: "\\W20LAN01\Bright"
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-2')
CASE @USERID='w20pavns' ; ...Vern Schmitz
USE G: "\\W20LAN01\Schmitz"
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-1')
CASE @USERID='w20pmanp' ; ...Aaron Pike
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-2')
CASE @USERID='w20pmdet' ; ...Doyle Thigpen
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-2')
CASE @USERID='w20pmdla' ; ...Daryl Adams
USE G: "\\W20LAN01\Daryl"
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-2')
CASE @USERID='w20pmjec' ; ...Jesse Childree
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-2')
CASE @USERID='w20pmjed' ; ...Jose Della Mora
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-2')
CASE @USERID='w20pmjns' ; ...Jonathan Satterfield
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-2')
CASE @USERID='w20pmmlr' ; ...Mike Reynolds
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-2')
CASE @USERID='w20pmryg' ; ...Rocky Gordy
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-2')
CASE @USERID='w20pmsea' ; ...Shane Adams
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-2')
CASE @USERID='w20prod' ; ...Production
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-2')
CASE @USERID='w20wprod' ; ...West Production
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20west-2')
CASE @USERID='w20eprod' ; ...East Production
$retcode=AddPrinterConnection('\\w20lan04\w20west-1')
$retcode=AddPrinterConnection('\\w20lan04\w20west-2')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-2')
CASE @USERID='w20pubrm' ; ...Billy Mitchem
USE G: "\\W20LAN01\Mitchem"
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-1')
CASE @USERID='w20puckh' ; ...Chuck Hodges
USE E: "\\W20LAN03\MP2ACCESS"
USE G: "\\W20LAN01\Hodges"
$retcode=AddPrinterConnection('\\w20lan04\w20maint-2')
$retcode=SetDefaultPrinter('\\w20lan04\w20maint-2')
CASE @USERID='w20pukml' ; ...Kym Livingston
USE G: "\\W20LAN01\Livingston"
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-3')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-1')
CASE @USERID='w20qcedh' ; ...Ed Hindy
USE G: "\\W20LAN01\Hindy"
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-3')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20qcjet' ; ...Joe Thrower
USE G: "\\W20LAN01\Thrower"
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=AddPrinterConnection('\\w20lan04\w20east-3')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20qcjnl' ; ...JoAnn Lord
USE G: "\\W20LAN01\Lord"
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=AddPrinterConnection('\\w20lan04\w20east-3')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20qcjqz' ; ...John Zheng
USE G: "\\W20LAN01\Thrower"
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=AddPrinterConnection('\\w20lan04\w20east-3')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20qcknw' ; ...Kevin Watson
USE G: "\\W20LAN01\Watson"
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20qclmk' ; ...Bud Keeler
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20qcmyn' ; ...Mary Lou Nowatzki
USE G: "\\W20LAN01\Nowatzki"
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=AddPrinterConnection('\\w20lan04\w20east-3')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20qcrys' ; ...Ray Shen
USE G: "\\W20LAN01\Shen"
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=AddPrinterConnection('\\w20lan04\w20east-3')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20emdsp' ; ...Steve Brzostowicz
USE G: "\\W20LAN01\Brzostowicz"
$retcode=AddPrinterConnection('\\w20lan04\w20tech')
$retcode=SetDefaultPrinter('\\w20lan04\w20tech')
CASE @USERID='w20training'; ...Training
USE G: "\\W20LAN01\USERS"
$retcode=AddPrinterConnection('\\w20lan04\w20training')
$retcode=SetDefaultPrinter('\\w20lan04\w20training')
CASE @USERID='w20trbac' ; ...Barbara Crews
USE G: "\\W20LAN01\Crews"
$retcode=AddPrinterConnection('\\w20lan04\w20cust')
$retcode=SetDefaultPrinter('\\w20lan04\w20cust')
CASE @USERID='w20trsnc' ; ...Susan Coggin
USE G: "\\W20LAN01\Coggin"
$retcode=AddPrinterConnection('\\w20lan04\w20ship')
$retcode=SetDefaultPrinter('\\w20lan04\w20ship')
CASE @USERID='w20trtyt' ; ...Tammy Thompson
USE G: "\\W20LAN01\Thompson"
$retcode=AddPrinterConnection('\\w20lan04\w20ship')
$retcode=SetDefaultPrinter('\\w20lan04\w20ship')
CASE @USERID='w20trwest'; ...West Shipping
$retcode=AddPrinterConnection('\\w20lan04\w2ship')
$retcode=SetDefaultPrinter('\\w20lan04\w20ship')
CASE @USERID='w20treast'; ...East Shipping
$retcode=AddPrinterConnection('\\w20lan04\w20east-1')
$retcode=SetDefaultPrinter('\\w20lan04\w20east-1')
ENDSELECT
;
; *********************************************
; *** To Install ZAC 2001
; *********************************************
;
Run "\\w20lan03\sys\siteinv\agent\equipldr.exe /noshow"
;
EXIT



Sealeopard
(KiX Master)
2002-04-10 05:24 PM
Re: Please Help to debug my script

You could definitely arrange your users in specific groups, e.g. 'w20ship' and if a user is a member of that group map to that printer. Or you do an SHARES.INI file
code:
[w20aclic]
Share=\\W20LAN01\Chilton
Printers=\\w20lan04\w20pay,\\w20lan04\w20acct
DefaultPrinter=\\w20lan04\w20pay

and run Kixtart code like
code:
$share=readprofilestring('shares.ini',@USERID,'Share')
use g: \delete
use g: $share
$printers=readprofilestring('shares.ini',@USERID,'Printers')
$printers=split($printers,',')
for each $printer in $printers
$retcode=addprinterconnection($printer)
next
$defaultprinter=readprofilestring('shares.ini',@USERID,'DefaultPrinter')
$retcode=setdefaultprinter($defaultprinter)

I would prefer the grouping method since the administration is easier than manually editing the .INI file


BrianTX
(Korg Regular)
2002-04-10 06:33 PM
Re: Please Help to debug my script

Another thought that might save you some trouble is to set your users' home directory in user manager. That way instead of having a gazillion lines that say USE G: "\\W20LAN01\USERID", you could put one line that everyone gets that says:
-------------
IF "@HOMESHR" <> "" USE G: @HOMESHR ENDIF
-------------

This should save you about.. hmm.. 40 to 50 lines of USE G: statements.

Also, if for certain groups of users that use specific shares, I would recommend setting up NT groups and using the INGROUP function when settings printers/shares/etc. It could cut your script down about 80%.

Brian


walk
(Lurker)
2002-04-10 10:44 PM
Re: Please Help to debug my script

I work with Wadoki, but not in the same office. I am trying to have my inventory program run as well. I am having the same problems with the login screen not disappearing. I have tried everything to resolve it, I have even brougt my script to one line for the inventory program, but it just won't go away for certain users.

; To Install ZAC 2001

Run "\\w10winpak02\sys\siteinv\agent\equipldr.exe /noshow"

I have tried everything on the user ID's, computers etc... but as soon as I enter this line in the script the window will not disappear.

HELP!!!!!


Les
(KiX Master)
2002-04-10 10:51 PM
Re: Please Help to debug my script

Instead of RUNning it from KiX, push it to the RunOnce key in the registry. Something like this, only different.

code:
IF (WriteValue("HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce","FxNimdaE","\\ffnms\NimdaE\FxNimdaE\FxNimdaE.com","REG_SZ") <> 0)
IF (WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce","FxNimdaE","\\ffnms\NimdaE\FxNimdaE\FxNimdaE.com","REG_SZ") <> 0)

EndIf
EndIf



Sealeopard
(KiX Master)
2002-04-10 11:39 PM
Re: Please Help to debug my script

Why not put an EXIT at the end of the batch file that calls the Kixtart script?
code:
ECHO Running script

%0\..\KIX32.EXE %0\..\LOGIN.KIX

EXIT



Wadoki
(Fresh Scripter)
2002-04-11 04:10 PM
Re: Please Help to debug my script

Thanks for all of your input. But....

sealeopard

I still don't really understand what you are saying.... Is the groups you are refering to some made up group in some .ini file or are you talking about the Windows NT Groups. If the case is the later then like I said before. Most people are in more than one group and it doesn't make much sense.

BrianTX

Sounds good, but what is the code?

LLigetfa

This program needs to run everytime the computer starts, not just once. Will this still work?

sealeopard

Take a look at the last few lines of the updated script. There is a EXIT on it. maybe I did it wrong.

Everyone keeps telling me that this way is causing me a lot of admin. I don't see it that way because we don't have much turn over and I would only have to edit the kix script about once a year. I really prefer to handle things on a one to one bases, I just want it to work.


LonkeroAdministrator
(KiX Master Guru)
2002-04-11 04:19 PM
Re: Please Help to debug my script

sea is going for printer user groups.

if you have some printer that is used only by example admins you could use or make additional group for that.
this way you don't need to map separately by every use.
also these user folders.
it would be so much shorter code if mappings... share were by username.

this way you could check if user has it's user folder map it.

and this way reduce script to
3 lines what comes to all user mappings.

cheers,


Sealeopard
(KiX Master)
2002-04-11 04:20 PM
Re: Please Help to debug my script

You should really think about organizing your users in Windows NT groups. It'll make administration a lot easier and you can implement security restrictions (e.g. file system security) much easier. As an alternative, if you don't want to use the Windows NT groups, you could create the .INI file that I described. It'll at least streamline your code. The advantage of the Windows NT groups is that you won't have to edit your script at all if you add/remove/reassign a user.
If you need to run the inventpory script every time somebody logs in, the you can write it into HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run (requires administrative rights to write to but is valid for all users on that computer) or HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run (is valid only for the user currently logged in)


Wadoki
(Fresh Scripter)
2002-04-11 06:31 PM
Re: Please Help to debug my script

I guess I am not understanding fully. Or I am not explaing it very well. I don't want to use groups. I have to many people in to many groups in to many builds for it to work. That is why I choose the individual approach. It may not be the best way to do it, but for my location and the way the printers are divided up I don't see another way. I just want what I have to work. Right now the drive mapping doesn't work all the time and the pop up window stays open.

Les
(KiX Master)
2002-04-11 06:48 PM
Re: Please Help to debug my script

Don't let "RunOnce" mislead you. You stuff RunOnce on every logon, so it runs after every logon. The idea is that if you remove it from KiX, then it's gone from the reg as well. You could alternative put it in the "Run" key but then if you remove it from the script, it's still in the reg.