Saturday, March 24, 2012

VB Script to Map Drives

Sometimes you need to map a local drive to a network drive, so you can easily access its contents. Normally this is done manually by IT for every new employee. However, there is an easier way... an automated way... a programming way. It can be done in VB! Below is what it looks like.


Option Explicit
Dim objNetwork, objExp
Dim strDriveLetter, strRemotePath
strDriveLetter = "T:"
strRemotePath = "\\network\drive"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
WScript.Quit


This is a big timesaver!

No comments: