C# 用于重置网络适配器
我正在寻找一些指向 C# 中的位置的指针,以便简单地重置网络设备。 我的原因是我工作中的一个盒子在进入待机状态后停止与我们的 Exchange 服务器通信,如果我可以有一个小应用程序,只需单击一下即可重置适配器,那就太好了。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“重置”是什么意思? 您的意思是适配器在进入待机状态时会丢失其地址并且在恢复时不会获得地址?
如果是这种情况,那么最简单的执行方法是调用 ipconfig /renew。
这可以使用
或简单地在桌面上放置一个批处理文件来完成,可以双击
其中的行。
编辑 ** 只是认为您可能需要在调用 IPConfig /renew ** 之前调用 IPConfig /Release **
对于企业应用程序,我会研究 Windows API,因为将有一些函数可以被调用来执行 ipconfig /renew 所做的事情,但为了简单起见以上应该没问题。
华泰
一次射击
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
or simply putting a batchfile on the desktop that could be double clicked with the line
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
尝试
“netsh 接口设置接口已禁用”
然后
“netsh 接口设置接口已启用”
try
"netsh interface set interface DISABLED"
then
"netsh interface set interface ENABLED"