Assigns a remote printer the role Default Printer.
|
---|
object.SetDefaultPrinter(strPrinterName) |
Arguments
- object
WshNetwork object.
- strPrinterName
String value indicating the remote printer's UNC name.
Remarks
Example
The following code uses the AddWindowsPrinterConnection method to connect a network printer and set it as the default printer.
Visual Basic Script | Copy Code |
---|
Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\research\library1"
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath |
JScript | Copy Code |
---|
var WshNetwork = WScript.CreateObject("WScript.Network");
var PrinterPath = "\\\\research\\library1";
WshNetwork.AddWindowsPrinterConnection(PrinterPath);
WshNetwork.SetDefaultPrinter(PrinterPath); |
See Also