#158199 - 2006-03-02 11:40 PM
Labeling mapped drives
|
shaju_devassy
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
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
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
also see my MapDrives() UDF
|
|
Top
|
|
|
|
#158202 - 2006-03-03 02:38 PM
Re: Labeling mapped drives
|
shaju_devassy
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
|
|
|
|
#158204 - 2006-03-03 02:57 PM
Re: Labeling mapped drives
|
shaju_devassy
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
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
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.
|
|
Top
|
|
|
|
#158207 - 2006-03-03 05:44 PM
Re: Labeling mapped drives
|
Howard Bullock
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."
|
|
Top
|
|
|
|
#158208 - 2006-03-03 06:53 PM
Re: Labeling mapped drives
|
shaju_devassy
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
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.
|
|
Top
|
|
|
|
#158211 - 2006-03-03 08:47 PM
Re: Labeling mapped drives
|
shaju_devassy
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(mole)
and 1300 anonymous users online.
|
|
|