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

See Also                      Applies To


Description
Sets the default printer to the remote printer specified.
Syntax
object.SetDefaultPrinter strPrinterName
Parameters
Part Description
object WshNetwork object.
strPrinterName Remote printer name to set as default, such as "\\Server\Printer1."
Example
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"