Assign a remote printer the role Default Printer.
Syntax
object.SetDefaultPrinter(strPrinterName)
Arguments
strPrinterName : The remote printer's UNC name.
Examples
'Set the Default Printer to \\research\library1
Dim net
Set net = CreateObject("WScript.Network")
net.SetDefaultPrinter "\\research\library1"
' Connect to \\research\library1 and set it as the default.
Set PrinterPath = "\\research\library1"
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set rc = WshNetwork.AddWindowsPrinterConnection(PrinterPath)
If Not rc then
WScript.Echo("Printer Connection Failed!")
End If
WshNetwork.SetDefaultPrinter PrinterPath
Notes
This method fails when using a DOS-based printer connection. You cannot use
the SetDefaultPrinter method find out the name of the current default printer.
Related commands:
Printer, add printer - WshNetwork.AddPrinterConnection
Printer, add Network printer - WshNetwork.AddWindowsPrinterConnection
Equivalent Windows NT command:
NET - Manage network resources