Scripting Home > > WScript Methods

RemoveNetworkDrive Method

Description

The RemoveNetworkDrive method is used to disconnect a network drive mapping from the local system.

object.RemoveNetworkDrive Device [, Force] [, UpdateProfile]

Parameters
The Device parameters specifies the network drive device to disconnect. For devices mapped to a local drive letter, this parameter should be the drive letter (x:), for other devices this should be the network path.

The optional Force parameter is a boolean value used to specify whether the device should be removed even if still in use.

The optional UpdateProfile is a boolean used to specify whether the mapping should be permanently removed from the users profile as well as the current session.

Example

'VBScript Example
Set WshNetwork = WScript.CreateObject("WScript.Network")

WshNetwork.RemoveNetworkDrive "S:", True, True

WshNetwork.RemoveNetworkDrive "\\server\share", True, True