Reputation: 751
I'm looking for some pointers to where I go in C# for simply resetting a network device. My reason being one of my boxes in work stops communicating with our Exchange servers after going into standby, and if I could have a small app that resets the adaptor with a single click it would be great.
Upvotes: 3
Views: 7527
Reputation:
try "netsh interface set interface DISABLED" then "netsh interface set interface ENABLED"
Upvotes: 2
Reputation: 6953
How do you mean "reset"? do you mean the Adapter loses it's address when going into standby and doesn't get one on resume?
if this is the case then the simplest way to perform it would be to call ipconfig /renew.
this could be done using
System.Diagnostics.Process.Start("ipconfig", "/renew");
or simply putting a batchfile on the desktop that could be double clicked with the line
IPConfig /renew
In there.
EDIT ** Just thought you may need to call IPConfig /Release before calling IPConfig /renew **
for an enterprise application i would look into the Windows API as there will be functions that can be called to do what ipconfig /renew does but for simplicity the above should be fine.
HTH OneSHOT
Upvotes: 5