Identify individual com port on windows

We have a setup where our product enumerates as 3 com ports. 

Is there a way to name each port from the code so they can be uniquely identified via windows?

The problem we have is that windows tend to swap the order of comport’s from time to time. We want to make a program that can find the right com port no matter the order the ports are enumerated 

Parents
  • Hello,

    I’m not entirely sure, but you might be able to use unique identifiers associated with each COM port, rather than just the port number. For example, running the command Get-CimInstance Win32_SerialPort | Format-List Name, DeviceID, PNPDeviceID, Description in PowerShell provides details about the COM ports, including the PNPDeviceID, which I believe remains consistent for the same physical device. This could be a reliable way to identify and track devices across different sessions. See the attached screenshot.

    Kind regards,

    Abhijith

Reply
  • Hello,

    I’m not entirely sure, but you might be able to use unique identifiers associated with each COM port, rather than just the port number. For example, running the command Get-CimInstance Win32_SerialPort | Format-List Name, DeviceID, PNPDeviceID, Description in PowerShell provides details about the COM ports, including the PNPDeviceID, which I believe remains consistent for the same physical device. This could be a reliable way to identify and track devices across different sessions. See the attached screenshot.

    Kind regards,

    Abhijith

Children
No Data
Related