WshNetwork.RemoveNetworkDrive

The RemoveNetworkDrive method removes the current resource connection denoted by strName.

Syntax

WshNetwork.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
 

Parameters

strName
The strName parameter can be either a local name or a remote name, depending on how the drive is mapped. If the drive has a mapping between a local name (drive letter) and a remote name, then strName must be set to the local name. If the network path does not have a local name (drive letter) mapping, then strName must be set to the remote name.
bForce
If bForce is supplied and its value is TRUE, this method removes the connections whether the resource is used or not.
bUpdateProfile
If bUpdateProfile is supplied and its value is TRUE, this mapping is stored in the user profile.

Example

Set WshNetwork = Wscript.CreateObject("Wscript.Network")

' Local name mapped to remote share
  WshNetwork.MapNetworkDrive "Z:", "\\Server\Share" 
  WshNetwork.RemoveNetworkDrive "Z:"
' No local name mapping, such as:
' NET USE \\Server\ShareWshNetwork.RemoveNetworkDrive "\\Server\Share"
  WshNetwork.MapNetworkDrive "\\Server\Share"
  WshNetwork.RemoveNetworkDrive "\\Server\Share"