public void SetDns(v4addr dns) { var target = GetManagementObject(); if (target != null) { ManagementBaseObject param = target.GetMethodParameters("SetDNSServerSearchOrder"); param["DNSServerSearchOrder"] = new[] { dns.ToString() }; target.InvokeMethod("SetDNSServerSearchOrder", param, null); } }
public void SetStaticIP(v4addr addr, v4addr mask) { var target = GetManagementObject(); if (target != null) { ManagementBaseObject param = target.GetMethodParameters("EnableStatic"); param["IPAddress"] = new[] { addr.ToString() }; param["SubnetMask"] = new[] { mask.ToString() }; target.InvokeMethod("EnableStatic", param, null); } }