8 years, 5 months ago.

A way for PC to discover mbed USBSerial COM port without administer rights?

Hi, I am using C# application to control mbed via USBSerial port. But it requires administer rights when I use the ManagementObjectSearcher to detect and connect the device. Does anyone know some other way can do so but without administer rights requirement?

private void FindSerialPortDevices(bool newArchitecture)
{
    int trial;
    string[] resources = SerialPort.GetPortNames();
    string instanceName;
    string portName;
    ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSSerial_PortName");

    if (resources.Count() > 0)
    {
        foreach (ManagementObject queryObj in searcher.Get())
        {
            /* 
             * ... ...
             * ... ...
             * MbedVendorId     :   Vid_1f00
             * ... ...
             * ... ...
             */
            trial = 0;
            instanceName = queryObj["InstanceName"].ToString();
            portName = queryObj["PortName"].ToString();
            
            ............
            
          }
     }
}
Be the first to answer this question.