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