hi guys, 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.
+1
A:
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
OneSHOT
2009-05-29 12:45:42
ok, that's got me on the right track! thanks again. I should have added that I was looking for some kind of C#/Windows equivalent to the up and down switches for the linux ifconfig command. Next time I ask a question I'll give it some real thought beforehand.
blackaardvark
2009-05-29 13:01:40
I think the up and down switches on ifconfig are more like disable/enable on the network adapter in windows. Doing this would cause the adapter to get an address in the same way IPConfig /renew would but i have a feeling that this would be considered more of a "reset" than the renew. http://channel9.msdn.com/playground/Sandbox/154712/ there is a link here to some c# code to enable/diable the adapter which may be closer to what you are after! HTH
OneSHOT
2009-05-29 13:52:58
I've found when this happens - loss of IP connectivity due to standby or other event - I don't need a "renew" but instead a "disable+enable" or "reset".
Cheeso
2009-05-29 13:58:55