Can I use WMI (C#) to disable/enable a device?

  • Thread starter Thread starter Michael
  • Start date Start date
Why would you want to do something like that? The only reason you
would possibly have to do this would be if you were planning to do it
remotely. Because I'm pretty sure you can disable any device locally
without the aid of any third party application. Are your intentions
ethical?????
 
If it is not in System.Management namespace then you have no luck for .Net
unless you want to try API.

chanmm
 
No. The WDM provider for WMI does not allow to do these things (for some
good reasons).
You need to interface with CfgMgr32 (Win32 API) to do this.
 
rhaazy,

It's for testing device drivers purposes.
Don't jump the gun with assumptions, ok?


-MH
 
Laura,

Thanks, I'll take a look at that.

-MH

Laura T said:
No. The WDM provider for WMI does not allow to do these things (for some
good reasons).
You need to interface with CfgMgr32 (Win32 API) to do this.
 
** "Michael" <[email protected]> ha scritto nel messaggio
** I'm exploring how to programmatically disable/enable devices in a system
** using C#.
**
** -MH
* "Laura T" <laura.t@_yahoo.com> scribed
* No. The WDM provider for WMI does not allow to do these things (for some
* good reasons).
* You need to interface with CfgMgr32 (Win32 API) to do this.
*
Laura T,

I believe Win32 API's setupapi.dll exports a function "SetupDiChangeState"
which allows for this but it's beyond my current skillset to fully
understand how to use it w/o seeing some sort of working C# source code
example. I'll keep plugging away at it. It may be best to start another
thread pertaining to this specific conundrum of mine.

Thanks,
-MH
 
| Michael wrote:
| ** "Michael" <[email protected]> ha scritto nel messaggio
| ** I'm exploring how to programmatically disable/enable devices in a
system
| ** using C#.
| **
| ** -MH
| * "Laura T" <laura.t@_yahoo.com> scribed
| * No. The WDM provider for WMI does not allow to do these things (for
some
| * good reasons).
| * You need to interface with CfgMgr32 (Win32 API) to do this.
| *
| Laura T,
|
| I believe Win32 API's setupapi.dll exports a function
"SetupDiChangeState"
| which allows for this but it's beyond my current skillset to fully
| understand how to use it w/o seeing some sort of working C# source
code
| example. I'll keep plugging away at it. It may be best to start
another
| thread pertaining to this specific conundrum of mine.
|
| Thanks,
| -MH

Anybody know how to use that API in C#? I'd be interested also in how
all the functions and structures are used along w/ the proper way to
pass parameters.
 
Back
Top