List of SerialPorts queried using WMI differs from devicemanager

wmi

I have the following serial ports listed in my devicemanager:

  • COM3
  • COM4 (BT)
  • COM5 (BT)
  • COM6 (GlobeTrotter MO67xx – Control Interface)
  • COM7 (GlobeTrotter MO67xx – GPS Control Interface)
  • COM8 (GlobeTrotter MO67xx – GPS Data Interface)
  • COM9 (GlobeTrotter MO67xx – Diagnostics Interface)
  • COM11 (USB Serial Port)
  • COM12 (USB Serial Port)
  • COM45 (SUNIX COM Port)
  • COM46 (SUNIX COM Port)

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:

  • COM3
  • COM4
  • COM5

Test 2:

root\WMI; Query: SELECT * FROM MSSerial_PortName only returns the following serial ports:

  • COM3
  • COM11
  • COM12
  • COM45
  • COM45

How can I get a complete list of serial ports?

Best Answer

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.

Related Topic