I am working on a project that requires me to check for a disabled device in Windows and if that device is found disabled, the program should enable it.
I have been using the following solution from a previous answer..
How do I disable a system device programatically?
Though I am receiving the following error when running it...
I am calling the program as shown in the linked post and am running it as soon as my program starts as shown,
private void Form1_Load(object sender, EventArgs e)
{
DisableHardware.DisableDevice(n => n.ToUpperInvariant().Contains("VID_11CA&PID_0219"), false);
}
On the system I am using for testing, I already have the device disabled (I am looking to enable it). I have tried building on different build configurations (x86, AnyCPU) and have tested on Windows XP and on Windows 7 but with the same issue.
Any suggestions?
After alot of headache and trial and error, the best solution was to simply use devcon to handle my device management and handled the execution of devcon through my program with the proper arguments.