0

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...

enter image description here

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?

Community
  • 1
  • 1
tastydew
  • 677
  • 8
  • 21
  • Is your program running with admin privileges? – Nasreddine Oct 28 '15 at 14:32
  • Yes, I am running it from every avenue possible. Administrative privileges, non-administrative, x86 and AnyCPU. The systems I am working on are all 32-bit I should note. – tastydew Oct 28 '15 at 14:34

1 Answers1

0

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.

tastydew
  • 677
  • 8
  • 21