#186374 - 2008-03-19 04:53 PM
I need a basic script for mapping drives
|
tiptonm
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
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
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
|
|
|
|
#186403 - 2008-03-20 02:11 PM
Re: I need a basic script for mapping drives
[Re: Mart]
|
tiptonm
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
   
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
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
Seasoned Scripter
   
Registered: 2002-08-16
Posts: 624
Loc: London, England
|
Use the @PRODUCTTYPE macro.
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
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
|
|
|
|
#186414 - 2008-03-21 10:39 AM
Re: I need a basic script for mapping drives
[Re: Mart]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
|
|
Top
|
|
|
|
#186499 - 2008-03-26 10:08 AM
Re: I need a basic script for mapping drives
[Re: Les]
|
tiptonm
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
   
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 931 anonymous users online.
|
|
|