目前写个小程式来方便修改电脑的ipv4设定,
但遇到有些电脑可以有些电脑不行,
程式码主要如下,从手动改成自动取得
ManagementClass myClss =
new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection myMOC = myClss.GetInstances();
foreach (ManagementObject MOject in myMOC)
{
if (!(bool)MOject["IPEnabled"]) continue;
MOject.InvokeMethod("EnableDHCP", null);
MOject.InvokeMethod("SetDNSServerSearchOrder", null);
break;
}
有试过用try catch去找问题,但都没显示错误讯息,
请问有人有遇过这问题吗?