Microsoft® Windows® Script Host SetDefaultPrinter Method |
WSH Reference Version 1 |
Sets the default printer to the remote printer specified.
object.SetDefaultPrinter strPrinterName
Part Description object WshNetwork object. strPrinterName Remote printer name to set as default, such as "\\Server\Printer1."
The following example uses the AddPrinterConnection method to connect a network printer to LPT1: and then sets it as the default printer:Set WshNetwork = WScript.CreateObject("WScript.Network") WshNetwork.AddPrinterConnection "LPT1:", "\\Server\Print1" WshNetwork.SetDefaultPrinter "\\Server\Print1"