Answer the question
In order to leave comments, you need to log in
Why don't the values of printer ports obtained via WMI in different ways match?
$Ports = Get-WmiObject Win32_TcpIpPrinterPort -namespace "root\CIMV2" -ComputerName $ComputerName
$Printers = Get-WmiObject Win32_Printer -namespace "root\CIMV2" -ComputerName $ComputerName
Further, for example, on the same computer, $Ports.Name returns me :
(10.0.66.204 10.0.66.210 10.0.66.246 10.0.66.247) , and $Printers.PortName
(XPSPort: USB001 10.0.66.247 HPLaserJet400MFPM425dn 10.0.66.246 SHRFAX:) Why is that ?
Ultimately, I need to get a bunch of printer - value(NOT name) port. Win32_Printer has no such parameter, and Win32_TcpIpPrinterPort has no printer information. I wanted to link them via .Name but they don't match.
Answer the question
In order to leave comments, you need to log in
Aren't the Get-Printer and Get-PrinterPort cmdlets right for you? For me they show matching Printer.PortName and Port.Name.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question