Option Explicit
Dim objNetwork, strDrive, objShell, objUNC, strUNCPrinter, wshshell
Dim strRemotePath, strDriveLetter, strNewName
Dim strRemotePath1, strDriveLetter1, strNewName1
Dim strRemotePath2, strDriveLetter2, strNewName2
Dim U
dim filesys
strDriveLetter = "G:"
strRemotePath = "\\DC-1\General"
strNewName = "General"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
' Section which actually renames the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
strDriveLetter1 = "T:"
strRemotePath1 = "\\DC-1\Sales"
strNewName1 = "Sales"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
' Section which actually renames the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter1).Self.Name = strNewName1
'Grab the user name
U = objNetwork.UserName
strDriveLetter2 = "U:"
strNewName2 = U & "'s User Drive"
' Home Folder is set by AD this will just rename it
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter2).Self.Name = strNewName2
WScript.Sleep 6000
Set filesys = CreateObject("Scripting.FileSystemObject")
if filesys.DriveExists("U") Then
MsgBox ("At least the drive exists")
End if
if filesys.IsReady("U") Then
MsgBox ("At least the drive is ready")
End if
if filesys.folderexists("U:\Program Files\Trillian") Then
MsgBox ("At least the folder exists")
End if
set WshShell = CreateObject("WScript.Shell")
WshShell.Run ("U:\Program Files\Trillian\trillian.exe")