In Windows 8.1 Pro, the connected USB device list is not showing while USB device is showing into Device Manager(Control Panel).
I have a .NET 3.5 application, where I am using the following code to get the list of connected USB Serial Port device
- ManagementObjectCollection collection;
- using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_SerialPort"))
- {
- string paytmUPIPort = "";
- collection = searcher.Get();
- foreach (var serialDevice in collection)
- {
- paytmUPIPort = string.Format("{0}", serialDevice.GetPropertyValue("DeviceID"));
- if(paytmUPIPort.ToUpper().Contains("COM"))
- {
- collection.Dispose();
- return paytmUPIPort;
- }
- }
- }
- collection.Dispose();