Microsoft® Windows® Script Host RemoveNetworkDrive Method |
WSH Reference Version 1 |
Removes the current resource connection denoted by strName.
object.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
Part Description object WshNetwork object. 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 Optional. If bForce is supplied and its value is TRUE, this method removes the connections whether the resource is used or not. bUpdateProfile Optional. If bUpdateProfile is supplied and its value is TRUE, this mapping is removed from the user profile.
The following example maps a network share to drive "Z" and removes the connection:Set WshNetwork = WScript.CreateObject("WScript.Network") WshNetwork.MapNetworkDrive "Z:", "\\Server\Share" WshNetwork.RemoveNetworkDrive "Z:"