Microsoft® Windows® Script Host EnumPrinterConnections Method |
WSH Reference Version 1 |
Returns the current network printer mappings.
objPrinters = object.EnumPrinterConnections
Part Description object WshNetwork object. objPrinters Variable reference to the collection of printers.
Items in this collection are local names and remote names. The first item in the collection is the port and the second item is the network mapping. This pattern continues for all the network printers in the collection.
The following example outputs the printer ports and network mappings:
Set WshNetwork = WScript.CreateObject("WScript.Network") Set oPrinters = WshNetwork.EnumPrinterConnections For i = 0 to oPrinters.Count -1 WScript.Echo oPrinters.Item(i) Next