#31885 - 2002-11-07 12:14 AM
Need help with script writing - I'm a total beginner....
|
Pilot
Lurker
Registered: 2002-11-04
Posts: 2
Loc: London
|
Hello everyone - this is my first post, and I hope you guys can help me.
I've only been working on Kixtart on and off for two days now, and need to have a script to map users drives etc. by the end of the week. Now, here is one I tried - it maps the drives OK, but not sure of the syntax - is this correct? As I say, bear in mind I'm a total beginner with this....
OK - to begin with me are using a Windows 2000 Active Directory Network. 90% of our users are using Windows 2000 Pro on their PC's, and the remainder are Windows 98 (I've not put scripting in for 98' yet).
In the user profile settings, their logon file is Logon.bat:
@ECHO OFF
REM Kixtart batch file to call Kixlogon.kix
%0\..\KIX32.exe KIXLOGON.kix
EXIT
The Kixlogon.kix script that is called looks like this:
DEBUG ON
;LOGON SCRIPT NOV 6TH 2002
;------------------ ;Set server details ;------------------
$LSERVER1 = "SERVER1"
$LSERVER2 = "SERVER2"
;---------------------------------------------- ;This displays a message to the user logging on ;----------------------------------------------
SETCONSOLE ("SHOW")
MESSAGEBOX("Welcome to the Network. Please wait while drives are connected",64,8)
;------------------------------------------------------------------------- ;Checks to ensure all files are located on the clients Windows 2000 system ;-------------------------------------------------------------------------
IF NOT EXIST ("C:\WINNT\KIX32.EXE")
COPY "@SERVER2+\NETLOGON\KIX32.EXE" "c:\WINNT" ENDIF
IF NOT EXIST ("c:\WINNT\KXRPC.EXE")
COPY "@SERVER2+\NETLOGON\KXRPC.EXE" "C:\WINNT" ENDIF
IF NOT EXIST ("c:\WINNT\SYSTEM32\KX32.DLL")
COPY "@SERVER2+\NETLOGON\KX32.DLL" "C:\WINNT\SYSTEMS32" ENDIF
IF NOT EXIST ("c:\WINNT\SYSTEM32\KX16.DLL")
COPY "@SERVER2+\NETLOGON\KX16.DLL" "c:\WINNT\SYSTEM32" ENDIF
IF NOT EXIST ("c:\WINNT\SYSTEM32\KX95.DLL")
COPY "@SERVER2+\NETLOGON\KX95.DLL" "C\WINNT\SYSTEM32" ENDIF
;----------------------------------------------- ;Test beep - if you hear this the script has run (so far!) ;-----------------------------------------------
BEEP
;IF INGROUP ("Admin")
; USE J: /DELETE
; USE J: "\\FILESERV\Administration" ;ENDIF
;IF INGROUP ("Buisiness Admin")
; USE J: /DELETE
; USE J: "\\FILESERV\Business Admin" ;ENDIF
;IF INGROUP ("ZONE1")
; USE J: /DELETE
; USE J: "\\FILESERV\Zone1" ;ENDIF
;IF INGROUP ("ZONE2")
; USE J: /DELETE
; USE J:\ "\\FILESERV\Zone2" ;ENDIF
;IF INGROUP ("ZONE3")
; USE J: /DELETE
; USE J: "\\FILESERV\Zone3" ;ENDIF
;IF INGROUP ("ZONE4")
; USE J: /DELETE
; USE J: "\\FILESERV\Zone4" ;ENDIF
;IF INGROUP ("ZONE5")
; USE J: /DELETE
; USE J: "\\FILESERV\Zone5" ;ENDIF
;--------------------------------------------------- ;This deletes all currently connected drive mappings ;---------------------------------------------------
USE J: /DELETE
USE T: /DELETE
;-------------------- ;This maps the drives ;--------------------
USE J: "\\FILESERV\Work"
;-------- ;Test map ;--------
USE T: "\\FILESERV\Profiles"
EXIT
OK - So there is my current 'testing' script.
I have a couple of questions though:
i. How long can a share be that kixtart maps drives to? (For example, if I had: USE "\\FILESERV\Business Management Department" would it work ok?
ii. Also, the part that copies files to your local PC- is that required? I've noticed that even though it runs, no files are present on the client PC....very odd behaviour - or is it supposed to be like that?
Anyway, thanks for any time you can spare on this - it's greatly appreciated.
Many thanks
Regards
Pilot
|
|
Top
|
|
|
|
#31886 - 2002-11-07 12:31 AM
Re: Need help with script writing - I'm a total beginner....
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
|
Top
|
|
|
|
#31887 - 2002-11-07 12:36 AM
Re: Need help with script writing - I'm a total beginner....
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
You want to copy ONLY Kix32.exe to the W2K client. ALL the other files are for Win9x support. Also you want to copy the files in the batch file not the KiXtart script.
then in your batch file you want to start the script by calling the local copy of "Kix32".
|
|
Top
|
|
|
|
#31893 - 2002-11-08 11:34 AM
Re: Need help with script writing - I'm a total beginner....
|
Pilot
Lurker
Registered: 2002-11-04
Posts: 2
Loc: London
|
Hi guys,
OK, I've not been able to spend as much time on scripting as I would have liked, but here is the latest attempt. I've followed your advice as best I can (and hope I've done it correctly....)
Anyway, here is the initial login.bat file that the users activates when logging on:
@Echo Off
IF "%OS%" == "Windows_NT" GOTO WinNT
c:\windows\command\XCOPY %0\..\KIX32.EXE %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL c:\windows\command\XCOPY %0\..\KX16.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL c:\windows\command\XCOPY %0\..\KX32.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V >NUL c:\windows\command\XCOPY %0\..\KX95.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%WINDIR%\SYSTEM\KIX32.EXE %0\..\kixlogon.kix
GOTO End
:WinNT
XCOPY %0\..\KIX32.EXE %WINDIR%\SYSTEM32\ /D /H /I /R /V >NUL
%WINDIR%\SYSTEM32\KIX32.EXE %0\..\kixlogon.kix
GOTO End
End
Now, this copies the KIX32.EXE folder to the client PC OK on Windows 2000, however I haven't tested it on Win98 yet (I actually got this script from the starter manual - cheers).
OK - this is the kixtart script that is called:
;------------------------------ ;Test script as of 7th Nov 2002 ;------------------------------
Debug ON
Break ON
;------------------ ;Set server details ;------------------
$lserver1 = "SERVER1"
$lserver2 = "SERVER2"
SetConsole ("show") ;EndIf
;------------------------------------------------------- ;Test beep - if you hear this the script has run so far! ;-------------------------------------------------------
If Exist "J:" /delete
EndIf
If Exist "L:" /delete
EndIf
If Exist "M:" /delete
EndIf
If InGroup ("Admin")
Use J: "\\IHQFS01\Admin" EndIf
If InGroup ("Business")
Use J: "\\FILESERV\Business" EndIf If InGroup ("Zone1")
Use J: "\\FILESERV\Zone1" EndIf If InGroup ("Zone2")
Use J: "\\FILESERV\Zone2" EndIf If InGroup ("Zone3")
Use J: "\\FILESERV\Zone3" EndIf If InGroup ("Zone4")
Use J: "\\FILESERV\Zone4" EndIf
If InGroup ("Zone5")
Use J: "\\FILESERV\Zone5" EndIf
If InGroup ("Zone6")
Use J: "\\FILESERV\Zone6" AddPrinterConnection ("\\FILESERV\Color2") ; SetDefaultPrinter ("\\IFILESERV\Color1") EndIf ;-------------------------------------------------------------------- ;This maps individuals to the root of the Zone directory if required ;--------------------------------------------------------------------
If InGroup ("All Zone")
Use L: "\\FILESERV\All Zone" EndIf ;----------------------------------------------------------- ;This maps users to the root of the Work drive if required ;-----------------------------------------------------------
If InGroup ("Work Root")
Use M: "\\FILESERV\Work" EndIf
So, does that look better? - It does map users to their correct drives. However, I have another question: Here, we have an agreement to always use the J: drive for users work/departmental directory. But, if I add a user to two or more groups (bearing in mind they are always mapped to J:), is it possible for the script to automatically map to the next drive letter if they become members of additional groups? (I hope that makes sense - it didn't when I was typing it...)
So, if a user is a member of Zone1 for example and had a mapping of: J: \\FILESERV\Zone1, when they get put into Zone3, could it automatically move to L: ? (we use K: as their home drives).
I hope that makes sense - but being Friday my brain is slowing down!
One last thing - the script is only set for Windows 2000 so far, as I said I haven't added the Windows 98 part yet.
Thanks
Cheers guys,
Pilot
|
|
Top
|
|
|
|
#31895 - 2002-11-08 03:10 PM
Re: Need help with script writing - I'm a total beginner....
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
Actually, the copy will only work if the user ahs permissions to copy into the %WINDIR% directory. Since most user do not have the required admin permissions, it'll fail. Thent he script call will fail, too since the executable is not present. For correct login scripts, see for example Mixed Win9x, W2K, WinXP Workstations
code:
If Exist "M:" /delete
EndIf
This is total garbage, please see the KiXtart Manual for correct syntax. Correct syntax would be code:
IF EXIST('M:\nul') USE M: /delete /persistent ENDIF
See also File Operations
Please read the KiXtart Manual and the FAQ Forum.
_________________________
There are two types of vessels, submarines and targets.
|
|
Top
|
|
|
|
#31896 - 2002-12-08 02:53 PM
Re: Need help with script writing - I'm a total beginner....
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
Very important is it to keep your kixtart client installation separate from script. A wrong way of calling your script may hang it by a share violation error.
To make a client installation easy you can use one of our iexpress packages, which you can find on our site.
F.e. we are using following script for all windows versions.
code:
@echo off if not exist %windir%\kix412.ok %0\..\kix412update.exe /q if exist %windir%kix32.exe %windir%\kix32.exe %0\..\your_script.kix if not exist %windir%kix32.exe %0%\..\kix32.exe %0\..\your_script.kix @echo off
The iexpress installation package kix412update.exe can be found on our site.
For more information about it see topic KIX-TOOL: fast check of local installed KiXtart files for users of "kix???update.exe" greetings.
btw: symbol on our homepage has been linked to related http://kixtart.org topic.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 840 anonymous users online.
|
|
|