예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }