Enable/ disable a LAN connection

Y

yyy

Hello,
Can someone please tell me how can I enable/ disable a LAN connection
using C#.NET?

Thanks in advance :D

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
G

Guest

W

Willy Denoyette [MVP]

Win32_NetworkConnection ConnectionState is read-only. You can't change it's
state.
Only thing you can do using WMI is unloading/loading the device driver for
you connection (exactly as the Control pannel Connections applet does when
disabling/enabling).

Willy.
 
W

Willy Denoyette [MVP]

It's not clear what exactly you want to achieve.
Do you wan't to disconnect from a remote resource (a file share for
instance), or do you wan't to disconnect a client session from a shared
resource?
Or is it something else?

Willy.
 
G

Guest

My error with the connection state. Thanks Willy.

You can still use interop to disconnect... that is if this what you are
looking for.

Good luck.
 
W

Willy Denoyette [MVP]

Brian,

I'm pretty sure the solution is in System.Management (WMI), but first we
have to know exactly what OP is looking for.

Willy.
 
Y

yyy

Who is Brian ?

What do you mean by "What OP looking for" ?

I couldn't do it with WMI. Do you have another idea ?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top