WSH » wshnetwork » MapNetworkDrive

Syntax:
WshNetwork.MapNetworkDrive (strLocalName, strRemoteName [,bUpdateProfile] [,strUser] [,strPassword])
strLocalName
Receives the drive letter to which to map the remtoe share point in strRemoteName.
strRemoteName
Receives the name ofd the remote share point that will be mapped to the drive letter in strLocalName.
bUpdateProfile
If this optional parameter is True, the mapping will be saved in the current user's profile.
strUser
When combined with strPassword, this parameter can be used to conenct to a remote drive using someone else's credentials.
strPassword
When combined with strUser, this parameter can be used to conenct to a remote drive using someone else's credentials.

The MapNetworkDrive method maps a remote drive onto a local drive letter.

The MapNetworkDrive method maps a remote share point specified by strRemoteName to a local drive letter specified by strLocalName. If the optional parameter bUpdateProfile is set to True (default is False), the mapping will be saved to the current user's profile. The parameters strUser and strPassword can be used to connect to remote drives using someone else's credentials.

Examples

Code:
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "Z:", "\\Server\PublicFiles"
Explanation:

This VBScript code maps the remote share point \\Server\PublicFiles to local drive letter Z.

Language(s): VBScript