WSH » wshnetwork » RemoveNetworkDrive

Syntax:
WshNetwork.RemoveNetworkDrive (strName, [,bForce] [,bUpdateProfile])
strName
Receives the name of a previously mapped share point to be removed.
bForce
If this optional parameter is set to True, then this method will remove the connection even if the resource is currently being used.
bUpdateProfile
If this optional parameter is set to True, the mapping will be removed from the current user's profile.

The RemoveNetworkDrive method removes a previously mapped network drive.

The RemoveNetworkDrive method removes a previously mapped network share point identified as strName. If the optional parameter bForce is set to True (default is False), then this method will remove the connection, even if the resource is currently being used. If the optional parameter bUpdateProfile is set to True (default is False), the mapping will be removed from the current user's profile.

Examples

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

This VBScript code maps the remote share point \\Server\PublicFiles to the local drive letter Z:, and then removes the mapped drive.

Language(s): VBScript