WshNetwork.EnumPrinterConnections

Enumerate printer connections.

Syntax 
      myObject.EnumPrinterConnections

Examples

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 VBScript commands

Printer, set default printer - WshNetwork.SetDefaultPrinter
Printer, remove printer - WshNetwork.RemovePrinterConnection
Equivalent Windows CMD command: NET VIEW - to view a list of printers.
Equivalent PowerShell cmdlet: GCIM -ClassName "Win32_Printer" -comp $strComputer


 
Copyright © 1999-2024 SS64.com
Some rights reserved