Removing a Printer Connection

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

To remove a printer connection, use the RemovePrinterConnection method, along with the Universal Naming Convention (UNC) path to the printer. RemovePrinterConnection can be used only to remove printer connections from the local computer. If you want to remove a printer connection on a remote computer, you will need to run the script using the WSHController object.

Scripting Steps

Listing 13.24 contains a script that removes a printer connection. To carry out this task, the script must perform the following steps:

  1. Create an instance of the WSH Network object.
  2. Use the RemovePrinterConnection method to delete the connection to the printer Xerox300 on the print server atl-ps-01.

Listing 13.24   Removing a Printer Connection

1 2 
Set objNetwork = CreateObject("Wscript.Network") objNetwork.RemovePrinterConnection "\\atl-ps-01\xerox3006"

send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net