Page 1 of 1 1
Topic Options
#186374 - 2008-03-19 04:53 PM I need a basic script for mapping drives
tiptonm Offline
Fresh Scripter

Registered: 2008-03-19
Posts: 6
I have used kix scripts for our citrix environment but I never created them. I need to create a script for adding a couple of network drives but its likely this could grow to printers at a later date. Any help would be appreciated. Im guessing you would put the script in the same location as the other scripts???

Thanks

Mark

Top
#186380 - 2008-03-19 05:47 PM Re: I need a basic script for mapping drives [Re: tiptonm]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I would always use the \\DomainName\Netlogon share to drop the KIX executables and the scripts
Create some domain groups and populate them with the users or groups that need certain NTFS Security on certain shares. Reuse the groups for your logon script to map the drives:
;*************************************************************************
; Script Name: LogonScript
; Author: Wim Rotty
; Date: 19/03/2008
; Description: Untested example to map drives!!!
;************************************************************************* 


;Script Options
If
Not @LOGONMODE
    Break On
Else
    Break Off
EndIf
Dim $RC
$RC = SetOption("Explicit", "On")
$RC = SetOption("NoMacrosInStrings", "On")
$RC = SetOption("NoVarsInStrings", "On")
If @SCRIPTEXE = "KIX32.EXE"
    $RC = SetOption("WrapAtEOL", "On")
EndIf

;Code

;Clean up existing mappings if any

Use
*
/Delete /Persistent

;Map Public
Use "P:" "\\ServerName\PublicShare"

;Map Project Shares"
Use
"Q:" "\\Server\Projects"

;Map Department Shares
Select

    Case InGroup("Accounting")
       
Use "R:" "\\Server\Accounting"
    Case InGroup("Engineers")
       
Use "R:" "\\Server\Engineers"
    Case InGroup("ICT")
       
Use "R:" "\\Server\ICT"
EndSelect

Top
#186401 - 2008-03-20 01:33 PM Re: I need a basic script for mapping drives [Re: Witto]
tiptonm Offline
Fresh Scripter

Registered: 2008-03-19
Posts: 6
Do I need to create a batch file to call the kix script. Currently we have Citrix login scripts and use login.bat to call them???

login.bat contains

@ECHO OFF
CLS
%LOGONSERVER%\NETLOGON\KIX32.EXE %LOGONSERVER%\NETLOGON\LOGIN.KIX /F

Top
#186402 - 2008-03-20 01:42 PM Re: I need a basic script for mapping drives [Re: tiptonm]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
The batch file calls login.kix so you should add it to the login.kix script. Maybe login.kix has child scripts for each task. If so you maybe want to make a separate script with the new functionality and call it from logon.kix.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186403 - 2008-03-20 02:11 PM Re: I need a basic script for mapping drives [Re: Mart]
tiptonm Offline
Fresh Scripter

Registered: 2008-03-19
Posts: 6
There are 3 scripts one for each divisions in the company. The script you gave me works perfect, how could I use that locally then use the existing scripts we have for our citrix users???
Top
#186405 - 2008-03-20 03:17 PM Re: I need a basic script for mapping drives [Re: tiptonm]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Combine them into a single script and determine which elements you are going to execute based on one or more of:
  • OS type
  • Server name
  • Server OU
  • Server group membership
  • Session information
  • User login
  • User group membership
  • User OU

Top
#186406 - 2008-03-20 04:20 PM Re: I need a basic script for mapping drives [Re: Richard H.]
tiptonm Offline
Fresh Scripter

Registered: 2008-03-19
Posts: 6
How would you set the script to run only on XP pc's for example?? The script I am testing is the one that was posted earlier

;*************************************************************************
; Script Name: LogonScript
; Author: Wim Rotty
; Date: 19/03/2008
; Description: Untested example to map drives!!!
;*************************************************************************

;Script Options
If Not @LOGONMODE
Break On
Else
Break Off
EndIf
Dim $RC
$RC = SetOption("Explicit", "On")
$RC = SetOption("NoMacrosInStrings", "On")
$RC = SetOption("NoVarsInStrings", "On")
If @SCRIPTEXE = "KIX32.EXE"
$RC = SetOption("WrapAtEOL", "On")
EndIf

;Code

;Clean up existing mappings if any
Use * /Delete /Persistent

;Map Public
Use "P:" "\\ServerName\PublicShare"

;Map Project Shares"
Use "Q:" "\\Server\Projects"

;Map Department Shares
Select
Case InGroup("CENTRAL\G_TE-IT")
Use "G:" "\\tes2k3fp1\it$"

EndSelect

Top
#186409 - 2008-03-21 12:02 AM Re: I need a basic script for mapping drives [Re: tiptonm]
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Use the @PRODUCTTYPE macro.

 Code:
If @PRODUCTTYPE = 'Windows XP Professional' 

Top
#186412 - 2008-03-21 08:57 AM Re: I need a basic script for mapping drives [Re: Richie19Rich77]
tiptonm Offline
Fresh Scripter

Registered: 2008-03-19
Posts: 6
Do you have a list of all the other macros I could use in my script?

Thanks

Mark

Top
#186413 - 2008-03-21 09:35 AM Re: I need a basic script for mapping drives [Re: tiptonm]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
They are all in the manual.
Page 115, 116, 117 and 118 of the 4.53 manual (don’t have the 4.60 at hand right now) has them all listed and explained.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186414 - 2008-03-21 10:39 AM Re: I need a basic script for mapping drives [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Or use the HTML Help File 4.53
Top
#186419 - 2008-03-21 02:42 PM Re: I need a basic script for mapping drives [Re: Arend_]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Another online source of the manual is available here

http://www.kixtart.org/manual/
_________________________
Today is the tomorrow you worried about yesterday.

Top
#186424 - 2008-03-21 03:23 PM Re: I need a basic script for mapping drives [Re: Gargoyle]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
A Word DOC ships with the binaries.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#186499 - 2008-03-26 10:08 AM Re: I need a basic script for mapping drives [Re: Les]
tiptonm Offline
Fresh Scripter

Registered: 2008-03-19
Posts: 6
We use a kix script for our citrix environment but I need to combine this so the mappings etc work locally. Can you see if there are any problems in this script???? I doesn't map any of the primary drives so im guessing I have made mistake.

Also we have a file that lists all the terminal servers, I have added my workstation name in and it works ok, and works ok with just terminal server in. Ill paste copy of these files at bottom of screen.

MTTEST.KIX

;Script Options
If Not @LOGONMODE
Break On
Else
Break Off
EndIf
Dim $RC
$RC = SetOption("Explicit", "On")
$RC = SetOption("NoMacrosInStrings", "On")
$RC = SetOption("NoVarsInStrings", "On")
If @SCRIPTEXE = "KIX32.EXE"
$RC = SetOption("WrapAtEOL", "On")
EndIf

;Code

;Clean up existing mappings if any
Use * /Delete /Persistent

:COMMON_DRIVES

USE H: "\\TES2K3FP1\@WUSERID$"
USE J: "\\CLIENT\C$"
USE T: "\\TES2K3FP1\TEMPLATES"

ENDIF

:PRIMARY_DRIVE

IF INGROUP("CENTRAL\PD_PS-GROUPS")
USE G: "\\TES2K3FP1\PROFILE22$"
ENDIF

IF INGROUP("CENTRAL\PD_HIS-GROUPS")
USE G: "\\TES2K3FP1\HIS$"
ENDIF

IF INGROUP("CENTRAL\PD_SFW-GROUPS")
USE G: "\\TES2K3FP1\SFW$"
ENDIF

IF INGROUP("CENTRAL\PD_SWH-GROUPS")
USE G: "\\TES2K3FP1\SWH$"
ENDIF

IF INGROUP("CENTRAL\PD_TE-IT")
USE G: "\\TES2K3FP1\IT$"
ENDIF

:SECONDARY_DRIVES

IF INGROUP("CENTRAL\SD_Central-Technical Drawings")
USE K: "\\TES2K3FP1\TECHNICAL DRAWINGS"
ENDIF

IF INGROUP("CENTRAL\SD_PS-GROUPS")
USE L: "\\TES2K3FP1\PROFILE22$"
ENDIF

IF INGROUP("CENTRAL\SD_HIS-GROUPS")
USE M: "\\TES2K3FP1\HIS$"
ENDIF

IF INGROUP("CENTRAL\SD_SYS-NAVISION")
USE N: "\\TES2K3FP1\NAVISION$"
ENDIF

IF INGROUP("CENTRAL\SD_SFW-GROUPS")
USE R: "\\TES2K3FP1\SFW$"
ENDIF

IF INGROUP("CENTRAL\SD_SWH-GROUPS")
USE O: "\\TES2K3FP1\SWH$"
ENDIF

IF INGROUP("CENTRAL\SD_TE-WAREHOUSE")
USE V: "\\TES2K3FP1\WAREHOUSE$"
ENDIF

IF INGROUP("CENTRAL\SD_CENTRAL-GLOBAL")
USE X: "\\TES2K3FP1\CENTRAL-GLOBAL$"
ENDIF

IF INGROUP("CENTRAL\SD_TE-P22-CUSTOMER-CARE-MEETING")
USE y: "\\TES2K3FP1\CUSTOMER CARE MEETING"
ENDIF

IF INGROUP("CENTRAL\SD_TE-PUBLIC-CE-SWH")
USE y: "\\TES2K3FP1\PUBLIC-CE-SWH"
ENDIF

:PUBLIC_DRIVES

IF INGROUP("CENTRAL\G_PS")
USE P: "\\TES2K3FP1\PS-PUBLIC$"
ENDIF

IF INGROUP("CENTRAL\G_HIS")
USE P: "\\TES2K3FP1\HIS-PUBLIC$"
ENDIF

IF INGROUP("CENTRAL\G_SFW")
USE P: "\\TES2K3FP1\SFW-PUBLIC$"
ENDIF

IF INGROUP("CENTRAL\G_SWH")
USE P: "\\TES2K3FP1\SWH-PUBLIC$"
ENDIF

;Subroutine which maps client connected drives into Citrix session

:CITRIX_CLIENT_DRIVES

SHELL "C:\WINDOWS\SYSTEM32\CMD.EXE /C %LOGONSERVER%\NETLOGON\CTXCLNTD.BAT"

RETURN


;Subroutine which sets background colour

:SET_BACKGROUND_COLOUR

WRITEVALUE("HKCU\Control Panel\Colors","Background","0 0 0","REG_SZ")

RETURN


:END



TEST.BAT

@ECHO OFF
CLS
%LOGONSERVER%\NETLOGON\KIX32.EXE %LOGONSERVER%\NETLOGON\TEST.KIX /F



TEST.KIX

IF @WKSTA="TELXP0309"

IF INGROUP("CENTRAL\G_EXTRUSIONS")
CALL "%LOGONSERVER%\NETLOGON\MTTEST.KIX"
ENDIF

IF INGROUP("CENTRAL\G_SYSTEMS")
CALL "%LOGONSERVER%\NETLOGON\MTTEST.KIX"
ENDIF

ENDIF


TEST.KIX Original

IF @WKSTA="TES2K3TS1" OR @WKSTA="TES2K3TS2" OR @WKSTA="TES2K3TS3" OR @WKSTA="TES2K3TS4" OR @WKSTA="TES2K3TS5"

IF INGROUP("CENTRAL\G_EXTRUSIONS")
CALL "%LOGONSERVER%\NETLOGON\MTTEST.KIX"
ENDIF

IF INGROUP("CENTRAL\G_SYSTEMS")
CALL "%LOGONSERVER%\NETLOGON\MTTEST.KIX"
ENDIF

ENDIF

Top
#186508 - 2008-03-26 08:02 PM Re: I need a basic script for mapping drives [Re: tiptonm]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Hello tiptonm
Please review this FAQ on how to post on a Bulletin Board. It will help you to post better here as well as other sites which use quite similar methods
Pay close attention to CODE TAGS for posting code, etc... It makes it much easier to read and help you when your post is formatted properly.


The Post/Reply Formatting Box and How to use it


Thanks

Top
#186511 - 2008-03-27 12:50 AM Re: I need a basic script for mapping drives [Re: NTDOC]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you SetOption("NoMacrosInStrings", "On"), then don't put macros in strings!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1782 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.73 seconds in which 0.014 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org