Assign a remote printer the role Default Printer.
Syntax
WshNetwork.SetDefaultPrinter(strPrinterName)
Arguments
strPrinterName : The remote printer's UNC name.
Examples
'Set the Default Printer to \\research\library1
Dim WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.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
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.
“People think that being famous is just about having your picture taken all the time and being rich rich rich, and you know what?... They're absolutely right” ~ Madonna
Related:
Printer, add printer - WshNetwork.AddPrinterConnection
Printer, add Network printer - WshNetwork.AddWindowsPrinterConnection
PRNMNGR - Add, delete, list printers and printer connections.