Page 1 of 1 1
Topic Options
#158199 - 2006-03-02 11:40 PM Labeling mapped drives
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
Hallo ,

I am using below mentioned command to map the users to their home folders.
USE J: "\\SERVER\Home folders$\school1\@userid"

Is it possible to let the user see it as "Your Home Folder" in Windows explorer. How to give a label to this mapped drive.

Thanks for you reply in anticipation.

Top
#158200 - 2006-03-02 11:43 PM Re: Labeling mapped drives
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
Yes, it is possible, however, due to drive mapping delays and the speed at which scripts run, the results are some times inconsistant.

I have worked around this issue with the following drive mapping/Renaming script. I use the "sleep" command to make the script wait long enough for drives to be mapped.

Code:
 
SLEEP 5
call "@ScriptDir\UDF\label.udf"
if ingroup ("ISGroup")
$RC = label(G:\,ISDept) ; Drive letter renaming function
$RC = label(H:\,@UserID) ; Drive letter renaming function
$RC = label(I:\,Share) ; Drive letter renaming function
$RC = label(X:\,Application) ; Drive letter renaming function
endif

exit



Code:
 
;FUNCTION Label (version 1.1)
;
;AUTHOR Lonkero
;
;ACTION Read and Write Drive Label
;
;SYNTAX Label("DRIVE","LABEL")
;
;PARAMETERS
; DRIVE
; - drive to rename
; LABEL
; - new name of the drive
; to read the label, leave out
;
;RETURNS
; nothing on write.
; on read the current label.
; check @error for possible errors
;
;DEPENDENCIES
; Minimum operating systems: Windows 2000/ME
;
;EXAMPLE
; "Current Label for C: is:"
; Label('c:')
; ? "Changing it..."
; Label('c:\','my fancy new name')
; if @error
; ? "ERROR OCCURED:" @serror
; else
; ? "New Label for C: is:"
; Label('c:')
; endif
;
;CODE
function label($_d,optional $_s)
$=createobject("shell.application")
if vartype($_s)
$.namespace(left($_d,1)+":\").self.name=$_s
exit @error
else
$label = $.namespace(left($_d,1)+":\").self.name
exit @error
endif
endfunction


_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#158201 - 2006-03-03 02:36 AM Re: Labeling mapped drives
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
also see my MapDrives() UDF
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#158202 - 2006-03-03 02:38 PM Re: Labeling mapped drives
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
Thanks very much for your reply,

Please let me where am i wrong.

i was trying the below mentioned but getting error at line 5.
ERROR : expected '>'!

USE P: "\\DC1\nis"
SLEEP 5
call "@ScriptDir\UDF\label.udf"
if ingroup ("Testgrp")
$RC = label(P:\,'Home Folder') ; Drive letter renaming function
endif

no changes made in label.udf

exit

Regards
Shaju

Top
#158203 - 2006-03-03 02:42 PM Re: Labeling mapped drives
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
In this line:

Code:

label(P:\,'Home Folder')



The p:\ should be between single quotes.
Like the example in the UDF says


Quote:


Label('c:\','my fancy new name')





Edited by Mart (2006-03-03 02:43 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#158204 - 2006-03-03 02:57 PM Re: Labeling mapped drives
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
Fanstastic, that's great. Excellent it works.

Thanks very much.

Top
#158205 - 2006-03-03 04:30 PM Re: Labeling mapped drives
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
i tried to apply this to a terminal server, it say's
ERROR : expected expression!
Script : C:\Documents and settings\Usernamexxx\KIXTART.KIX

Error on this line :- $RC = label('J:\','Home Folder')

My code goes so on.
-------------------
IF INGROUP("gr1")
MD "\\ts\home folders$\school1\@USERID"
ENDIF

IF INGROUP("gr1")
USE J: "\\ts\home folders$\school1\@userid"
ENDIF
SLEEP 5
call "@ScriptDir\UDF\label.udf"
IF INGROUP("DA")
$RC = label('J:\','Home Folder') ; Drive letter renaming function
ENDIF
Exit

Does this code work also on terminal server.
Help please,

Top
#158206 - 2006-03-03 05:16 PM Re: Labeling mapped drives
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
My guess is that the UDF is not loading.

Output "@ScriptDir\UDF\label.udf"

Is it the valid location of label.udf?

You could also try to just include the text of the UDF in your script.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#158207 - 2006-03-03 05:44 PM Re: Labeling mapped drives
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA

Also you can check @error and @serror after the call to see if it succeeded.

call "fictitious.file"
@Serror


yields "The system cannot find the file specified."
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#158208 - 2006-03-03 06:53 PM Re: Labeling mapped drives
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
yes indeed it's not running the udf file. I belive @ScriptDir is the folder where kix32.exe exists.
label.udf is wel inside UDF Folder. If i give the full path then it works.
call "C:\WINDOWS\SYSVOL\sysvol\schl.local\scripts\UDF\label.udf"

Top
#158209 - 2006-03-03 07:05 PM Re: Labeling mapped drives
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
What was being returned by @scriptdir?

I do not think you should be hard coding the full path as described in your last post.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#158210 - 2006-03-03 08:42 PM Re: Labeling mapped drives
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
You can also create a sub directory called UDF and place the label.udf in that folder. This would allow the UDF to load.

Or you can take the advice of including the text from the UDF file in your .kix script (minus the CALL for the .UDF file if you do this).
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#158211 - 2006-03-03 08:47 PM Re: Labeling mapped drives
shaju_devassy Offline
Fresh Scripter

Registered: 2005-09-30
Posts: 22
call "c:temp.txt"
@serror
@error
@scriptdir

all returns only this error

ERROR : expected expression!
Script : C:\Documents and settings\Usernamexxx\KIXTART.KIX

Top
#158212 - 2006-03-03 09:23 PM Re: Labeling mapped drives
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
You can't call a text file (unless it is a kixtart script with that extension, though not recommended)
Top
#158213 - 2006-03-03 09:24 PM Re: Labeling mapped drives
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
KIXTART.KIX

Is the name of the default KiXtart script that KiX will look for if it can't find a specified script.

You need to specify the script to open / use.

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
1 registered (mole) and 1300 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.052 seconds in which 0.019 seconds were spent on a total of 12 queries. Zlib compression enabled.

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