Share this Page URL

Chapter 9. The Windows Script Host > Network Printer-Related Functions - Pg. 587

RemoveNetworkDrive The RemoveNetworkDrive method disconnects a specified network share: objNetwork.RemoveNetworkDrive strName, [bForceDisconnect], [bUpdateProfile] The RemoveNetworkDrive method has two optional parameters, the first being a Boolean ForceDisconnect flag. If set to True, it will forcefully disconnect the drive, even if it is currently in use. The second parameter specifies whether the user's profile is to be updated. If there is a possibility of a drive being mapped to another network connection and you wish to connect it to a different network share, first delete the existing connection using the RemoveNetworkDrive method. The following (forcefully) removes the T: drive connection: objWshNetwork.RemoveNetworkDrive "T:", True, True objWshNetwork.MapNetworkDrive "P:", _ "\\THOR\PublicArea", True Network Printer-Related Functions WSH provides access to connected network printers in a similar fashion to network drives. You can enumerate (list), add, and remove network printer connections. The network printers are connected to a specified printer port, such as LPT1.