Microsoft® Windows® Script Host
RemovePrinterConnection Method
WSH Reference
Version 1

See Also                      Applies To


Description
Removes the current resource connection denoted by strName.
Syntax
object.RemovePrinterConnection strName, [bForce], [bUpdateProfile]
Parameters
Part Description
object WshNetwork object.
strName The strName parameter can be either a local name or a remote name, depending on how the printer is connected. If the printer has a mapping between a local name (for example, LPT1) and a remote name, then strName must be set to the local name. If the network path does not have a local name 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.
Example
The following example removes a printer connection from LPT1:
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.RemovePrinterConnection "LPT1:"