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
dim drives
dim DiskDrive
dim DriveLetter,DriveType,IsReady
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
Set Drives = FileSystemObject.Drives 'Create a drives collection
'step through the drive collection, and extract
'the drive letter and the type of drive
'according to the Microsoft VBScript documentation
'there are 6 distinct types of drive
For Each DiskDrive in Drives
DriveLetter = DiskDrive.DriveLetter
DriveType = DiskDrive.DriveType
IsReady = DiskDrive.IsReady
Select Case DriveType
Case "0" DriveType = "Unknown type of drive"
Case "1" DriveType = "Removable drive"
Case "2" DriveType = "Fixed drive"
Case "3" DriveType = "Network drive"
Case "4" DriveType = "CD-ROM drive"
Case "5" DriveType = "RAM Disk"
End Select
If IsReady Then
MsgBox ("Ready drive at " & DriveLetter & " of type " & DriveType)
Else
MsgBox ("Unready drive at " & DriveLetter & " of type " & DriveType)
End If
Next
if filesys.folderexists("U:\Program Files\Trillian") Then
MsgBox ("At least the folder exists")
End if
set WshShell = CreateObject("WScript.Shell")
WshShell.CurrentDirectory = "U:\Program Files\Trillian\"
WshShell.Run ("trillian.exe")