我正在使用ManagementClass構建此IP管理器工具,但在嘗試通過WMI設置IPv6地址時遇到問題。使用WMI(C#)設置靜態IPv6 IP地址
我正在使用的代碼的相關部分是以下各項:
ManagementBaseObject ipParams = wmiManager.GetMethodParameters("EnableStatic");
ipParams["IPAddress"] = ipAddresses; // { "fe80::fcd8:70b5:89f3:825d" }
ipParams["SubnetMask"] = netmasks; // { "64" }
wmiObject.InvokeMethod("EnableStatic", ipParams, null);
當IPv6地址(標準格式)與子網掩碼(整數格式)被傳遞給EnableStatic方法,它不」似乎應用它。
我認爲它可能有問題驗證子網掩碼,但我不確定是否有完整的IPv6子網掩碼符號。再次,它可能是驗證IP地址或完全不同的東西。
我對這個ManagementClass的東西相當陌生,我還沒有想出讀出錯誤的方法。如果有人對此有一些指示,請告訴。
你讀過這篇文章嗎?http://stackoverflow.com/questions/3360230/can-i-use-enablestatic-for-configuring-an-ipv6-addres-using-wmi –