IPrintServer2 Property: ConnectedPorts

Property Name

Property Type

This is a right only property and it gets the ports to which the printer will be connected.


Dim ps2 As IPrintServer2
'to get the iprintserver2 interface
Set ps2 = GetObject("ntds://sqlserverdom/sqlserver")
'Initialize the target machine for installation. This is a compulsory step, which creates the necessary shares on the target machine

'The 'Manufacturer' property is a write-only property and signifies the manufacturer selected for install
Dim AllManufacturers
Dim FriendlyNames
AllManufacturers = ps2.PrinterTypes(FriendlyNames)
Dim manufacturer_name
For Each manufacturer_name In FriendlyNames
  Debug.Print manufacturer_name
Next manufacturer_name

'Associated with each manufacturer is a list of supported models which can be got using the PrinterModels property.
Dim PerManufacturer_Models
PerManufacturer_Models = ps2.PrinterModels("Schlumberger")
Dim model_name
For Each model_name In PerManufacturer_Models
  Debug.Print model_name
Next model_name

'Select a manufacturer for installation
ps2.Manufacturer = "Schlumberger"

'Select a printer model for installation
'Note: The printer model must be supported by the Manufacturer selected for install.

ps2.Model = "Schlumberger 5232 Color PostScript Printer v50.3"

'ConnectedPorts' is a write only property that signifies the ports to which the new printer will be connected
ps2.ConnectedPorts = "LPT1:"


See Also