WshNetwork.RemoveNetworkDrive

Remove a shared network drive mapping.

Syntax 
      WshNetwork.RemoveNetworkDrive(strName, [bForce], [bUpdateProfile])

options:

   strName : The mapped drive you want to remove.  
   
   bForce  : Force the removal of the mapped drive. 
             (boolean, default = false)
   
   bUpdateProfile : Remove the mapping from the user's profile. 
                    (boolean, default = false)

Example

   Dim WshNetwork
   Set WshNetwork = CreateObject("WScript.Network")
   WshNetwork.MapNetworkDrive "I:", "\\print_server\hp_01","True","jdoe","jdoepassword"
   WshNetwork.RemoveNetworkDrive "I:"

"No problem is so formidable that you can't walk away from it" - Charles M. Schulz

Related commands:

Map drive - WshNetwork.MapNetworkDrive
List drive mappings - WshNetwork.EnumNetworkDrives
Equivalent Windows CMD command: NET - Manage network resources



Back to the Top

Simon Sheppard
SS64.com