The class provides a disable/enable method but they aren't implemented.
It's up to the device driver to accept/implement the commands and currently
none of the network driver implements these methods, that's why the methods
aren't implemented at the WMI provider either.
One option is to get a copy of Devcon.exe from the MS download site, but
keep in mind that this tool is not distributable and should only be used for
diagnostic purposes.
Note that I fail to see why you need to disable a NIC, maybe there is
another way to achieve what you are after.
Willy.
| Hi all,
| today when i look again at this link
|
http://msdn.microsoft.com/library/d...ry/en-us/wmisdk/wmi/wmi_tasks__networking.asp
|
| I see that we can enable or disable NIC
| ****
| Use the Win32_NetworkAdapter class and the Disable or Enable methods.
| ****
|
| But when I use this method to disable the network adapter I receive a
error
| message in debug window
| ****
| ManagementException was unhandled
| This methode was not implemented
| *****
|
| Hier is my source code
| ***********
| ManagementClass mc = new ManagementClass("Win32_NetworkAdapter");
| ManagementObjectCollection moc = mc.GetInstances();
|
|
| foreach(ManagementObject mo in moc)
| {
| ManagementBaseObject mbo = null;
| mbo = mo.GetMethodParameters("Disable"); //the error comes here...
| }
| *************
|
| What should I do now to use this method? Should I update the new version
of
| .net framework? I'm using now VS 2005 with .net 2.0
| All help will be appreciated.
| rca.
|
|
| "rongchaua" wrote:
|
| > Hi,
| > WMI can not disable or enable NIC.
| >
http://msdn.microsoft.com/library/d...ry/en-us/wmisdk/wmi/wmi_tasks__networking.asp
| > But I found another.
| >
http://channel9.msdn.com/ShowPost.aspx?PostID=158556
| > Regards.
| > rongchaua.
| >
| > "Ignacio Machin ( .NET/ C# MVP )" wrote:
| >
| > > Hi
| > > | > >
| > > >
| > > > Which is exactly what's exposed by System.Management or is this not
part
| > > > of
| > > > the framework.
| > >
| > >
, good point.
| > >
| > >
| > >
| > > --
| > > --
| > > Ignacio Machin,
| > > ignacio.machin AT dot.state.fl.us
| > > Florida Department Of Transportation
| > >
| > >
| > >