On Error Resume Next
Strremotepath = " \ UNC path "
Strnewname = " Name to be displayed "
Set Objnetwork = Createobject ( " Wscript. Network " )
Set Coldrives = Objnetwork. enumnetworkdrives
For I = 0 To Coldrives. Count - 1 Step 2
Set Objshell = Createobject ( " Shell. Application " )
Strdriveletter = Coldrives. Item (I)
Strname = Objshell. namespace (strdriveletter). Self. Name
Strname = Left (Strname, Len (Strname) - 5 )
If Strname = Strnewname Then Wscript. Quit
Strdriveletter = CHR ( ASC ( Left (Coldrives. Item (I ), 1 )) - 1 ) & " : "
Next
If strdriveletter = " " then strdriveletter = " Z: "
' section to map the network drive
set objnetwork = Createobject ( " wscript. network " )
objnetwork. mapnetworkdrive strdriveletter, strremotepath
' section which actually (re) names the mapped drive
set objshell = Createobject ( " shell. application " )
objshell. namespace (strdriveletter ). self. name = strnewname