5

Possible Duplicates:
[.NET] How do I disable a system device?
Win32 API function to programatically enable/disable device

Is there a way, in C#, to programmatically disable and re-enable a device? I'm looking for essentially the same functionality that occurs when you go into device manager and right click on a device and disable or enable it. How can I do this in C#?

Community
  • 1
  • 1
Icemanind
  • 43,745
  • 45
  • 159
  • 272
  • It's a double of http://stackoverflow.com/questions/252185/net-how-do-i-disable-a-system-device – Abel Aug 16 '10 at 22:56

2 Answers2

2

Take a look at net-how-do-i-disable-a-system-device.

Community
  • 1
  • 1
Will A
  • 23,926
  • 4
  • 46
  • 60
0

According to this link: http://bytes.com/topic/c-sharp/answers/513855-can-i-use-wmi-c-disable-enable-device

You need to interface with CfgMgr32 (Win32 API) to do this.

My first thought was to look at WMI but it's not there.

DevCon, which comes with the Device Drive Toolkit, provides a CLI to do this.

http://msdn.microsoft.com/en-us/library/ff541193(VS.85).aspx

Abel
  • 52,738
  • 19
  • 137
  • 227
Keith Adler
  • 20,230
  • 24
  • 116
  • 184