Disconnecting a Network DriveThe following script uses the WshNetwork object's RemoveNetworkDrive method to disconnect a mapped network drive. The first parameter to this function is the drive letter. The optional second parameter is a boolean that indicates whether to force the drive to be disconnected even if it is in use (default false). The optional third parameter is also a boolean. It shows whether to update the user's profile with the change just made.
The WshNetwork object has other useful methods, including ones such as AddPrinterConnection and RemovePrinterConnection. Back to the Using WSH to Automate Tasks page |