Home NT WSH
WshNetwork.EnumPrinterConnections

Enumerate printer connections

Syntax 
      myObject.EnumPrinterConnections

Example

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to oPrinters.Count - 1 Step 2
   WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)
Next

"Utility is when you have one telephone, luxury is when you have two, opulence is when you have three -- and paradise is when you have none" - Doug Larson (English middle-distance runner)

Related commands:

Printer, set default printer - WshNetwork.SetDefaultPrinter
Printer, remove printer - WshNetwork.RemovePrinterConnection

Equivalent Windows NT command:

NET VIEW - to view a list of printers
NET PRINT - View and Delete print jobs
PRNCNFG - Display, configure or rename a printer
PRNDRVR - Add, delete or list printer drivers.
PRNMNGR - Add, delete, or list printers / connections, set the default printer.
CON2PRT - Connect or disconnect a Printer



Back to the Top

Simon Sheppard
SS64.com