I have the following serial ports listed in my devicemanager:
The SUNIX COM ports are connected via an internal PCI-Card. The USB Serial Port is connected via USB (FDTI-chip) The GlobeTrotter ports are from a GlobeTrotter device connected via USB. There are also a modem, a USB-device and a network device listed for this modem.
So I have several different sources of serial ports.
All I want to do is to get a list containing all those ports using WMI.
For my tests I am using WMI Code Creator
Test 1:
root\CIMV2
; Query: SELECT * FROM Win32_SerialPort
only returns the following serial ports:
Test 2:
root\WMI
; Query: SELECT * FROM MSSerial_PortName
only returns the following serial ports:
How can I get a complete list of serial ports?
I found the solution.
The following query (root\CIMV2
) gets the requested results:
SELECT * FROM Win32_PnPEntity WHERE ClassGuid="{4d36e978-e325-11ce-bfc1-08002be10318}"
Update
This answer is pretty old now. Ehen I asked it I still had to consider WinXP and was using Windows7. Since I don't deal with serial ports any more, I can't give any new information on that issue. At that time this solution reported all ports that the devicemanager was showing. But I know listing serial ports is not that easy so this answer might not be correct in all scenarios.