Skip to content

Instantly share code, notes, and snippets.

@arman-hpp
Created August 8, 2016 03:23
Show Gist options
  • Save arman-hpp/dcb873c959ba09f9dfee46c6bad9f93d to your computer and use it in GitHub Desktop.
Save arman-hpp/dcb873c959ba09f9dfee46c6bad9f93d to your computer and use it in GitHub Desktop.
KeyboardSearcher.cs
private static void Main(string[] args)
{
ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Keyboard");
var devs = managementObjectSearcher.Get();
foreach (var o in devs)
{
var dev = (ManagementObject) o;
Console.WriteLine("-----------------------------------------------------");
Console.WriteLine(dev["Name"].ToString());
if (dev["DeviceId"].ToString() == @"USB\VID_0518&PID_0001&MI_00\6&1E9AA406&0&0000")
{
}
foreach (var prop in dev.Properties)
{
Console.WriteLine(prop.Name + ":" + prop.Value);
}
}
Console.ReadKey();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment