Option Explicit ' Set some varibles we need to check network presence Dim sServer, oWSShell 'This is the server we need sServer = "SAMBA-SERVER" 'Only go if we could ping server Set oWSShell = CreateObject("WScript.Shell") If CBool(oWSShell.Run("ping -n 1 " & sServer, 0, True)) Then Wscript.Quit 0 End If ' Set some variables Dim oNetwork, oShellApp, oDrives Set oNetwork = CreateObject("WScript.Network") Set oShellApp = CreateObject("Shell.Application") Set oDrives = oNetwork.EnumNetworkDrives 'Mount drives MountNetDrive "backups", "x", "backups" MountNetDrive "public", "y", "public" MountNetDrive "belminf", "z", "belminf" ' Extra code just to add a message box WScript.Echo "Mapped Network Drives For: " & sServer WScript.Quit 1 'FUNCTION: Mount network drive '' sShare = The share name, ie public '' sDrive = Just the letter of the drive, ie Z '' sName = Description of the drive, ie Home Drive Sub MountNetDrive(sShare, sDrive, sName) 'Make sure it's not mapped already Dim i For i = 0 To oDrives.Count -1 Step 2 If LCase(sDrive & ":") = LCase(oDrives.Item(i)) Then If Not LCase("\\" & sServer & "\" & sShare) = LCase(oDrives.Item(i+1)) Then ' Unmap drive and exit loop oNetwork.RemoveNetworkDrive sDrive & ":", true, true Exit For Else 'Just name drive and exit function oShellApp.NameSpace(sDrive & ":\").Self.Name = sName Exit Sub End If End If Next 'Map drive oNetwork.MapNetworkDrive sDrive & ":", "\\" & sServer & "\" & sShare 'Name drive oShellApp.NameSpace(sDrive&":\").Self.Name = sName End Sub