WshNetwork.SetDefaultPrinter

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. 

Make a Free Website with Yola.