USB Device List

Получить лист USB девайсов из C#?

 void GetUSBDevices()
        {
            _USBDevicesCollection.Clear();

            ManagementObjectCollection collection;
            using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub"))
                collection = searcher.Get();

            foreach (var device in collection)
            {
                _USBDevicesCollection.Add(new USBDeviceInfo(
                (string)device.GetPropertyValue("DeviceID"),
                (string)device.GetPropertyValue("PNPDeviceID"),
                (string)device.GetPropertyValue("Description")
                ));
            }

            collection.Dispose();

        }

 

USB Device List

GitHub

Комментирование закрыто.