Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
The WSH AddWindowsPrinterConnection method provides a quick and easy way to add a printer connection to the local computer. (To add a printer connection to a remote computer, you will need to run the WSH script using the WSHController object.)
The AddWindowsPrinterConnection method requires only a single parameter: the UNC path to the network printer. For example, this line of code adds a connection to the printer named ColorPrinter managed by the print server atl-ps-001:
objNetwork.AddWindowsPrinterConnection
"\\atl-ps-001\ColorPrinter
"
After a printer connection has been created, you can optionally use the SetDefaultPrinter method to configure the new connection to be the default printer. SetDefaultPrinter also requires only one parameter: the UNC path to the network printer.
Listing 13.23 contains a script that adds a printer connection on the local computer. To carry out this task, the script must perform the following steps:
Listing 13.23 Adding a Printer Connection
|
|
Send us your feedback | « Previous | Next » |