hey evreyone :)
I want to make an list of specific keyboards and mouses that the user allowed to use.
I have some computers and it may be in the GP locally.
any one knows??
thank you so much for your help!!
Noam.
hey evreyone :)
I want to make an list of specific keyboards and mouses that the user allowed to use.
I have some computers and it may be in the GP locally.
any one knows??
thank you so much for your help!!
Noam.
For you to allow or disallow a USB device the device needs a INF file that includes the following
; ========== Manufacturer/Models sections ===========
[Manufacturer]
%ManufacturerName% = Standard,NTamd64
[Standard.NTamd64]
%DeviceName% =USB_Install, USB\VID_0547&PID_1002
If the device does not then it's not possible to continue.
Next up, only managed code is with UWP applications - How to get USB descriptors
Prior to the above for UWP you need to use code like the following.
public class WinDevices
{
static public List GetUSBDevices()
{
List devices = new List();
ManagementObjectCollection collection;
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PnPEntity"))
collection = searcher.Get();
foreach (var device in collection)
{
var deviceInfo = new DeviceInfo();
deviceInfo.DeviceID = (string)device.GetPropertyValue("DeviceID");
deviceInfo.PNPDeviceID = (string)device.GetPropertyValue("PNPDeviceID");
deviceInfo.Description = (string)device.GetPropertyValue("Description");
deviceInfo.Name = (string)device.GetPropertyValue("Name");
deviceInfo.Caption = (string)device.GetPropertyValue("Caption");
deviceInfo.Service = (string)device.GetPropertyValue("Service");
devices.Add(deviceInfo);
// Other properties supported by Win32_PnPEntity
// See http://msdn.microsoft.com/en-us/library/aa394353%28v=vs.85%29.aspx
//var keys = new string[] {
// "Availability",
// "Caption",
// "ClassGuid",
// "CompatibleID[]",
// "ConfigManagerErrorCode",
// "ConfigManagerUserConfig",
// "CreationClassName",
// "Description",
// "DeviceID",
// "ErrorCleared",
// "ErrorDescription",
// "HardwareID[]",
// "InstallDate",
// "LastErrorCode",
// "Manufacturer",
// "Name",
// "PNPDeviceID",
// "PowerManagementCapabilities[]",
// "PowerManagementSupported",
// "Service",
// "Status",
// "StatusInfo",
// "SystemCreationClassName",
// "SystemName"
//};
}
collection.Dispose();
return devices;
}
public class DeviceInfo
{
public string Name { get; set; }
public string DeviceID { get; set; }
public string PNPDeviceID { get; set; }
public string Description { get; set; }
public string Caption { get; set; }
public string Service { get; set; }
}
}
11 people are following this question.