Map a network drive (VBScript)

This code can be found in Chapter 7 of Windows XP Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' From the book, "Windows XP Cookbook"
' ISBN: 0596007256

' ------ SCRIPT CONFIGURATION ------
strDrive = "<Drive>" ' e.g. N:
strPath = "<Path>" ' e.g. \\rtp01\c$\temp
strUser = "<User>" ' e.g. AMER\rallen
strPassword = "<Password>"
boolPersistent = True ' True = Persistent ; False = Not Persistent
' ------ END CONFIGURATION ---------
set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDrive, strPath, boolPersistent, _
 strUser, strPassword
WScript.Echo "Successfully mapped drive"

This code has been viewed 10280 times.

New from the creators of TechTasks.com: StatSheet.com