Using system.management;
Namespace arli.commonprj {public class change {
///
private ManagementBaseObject iObj = null; private ManagementBaseObject oObj = null; private ManagementClass mc = new ManagementClass ( "Win32_NetworkAdapterConfiguration"); private readonly ManagementObjectCollection moc;
/// /// arli.commonprj.changeip o = new arli.commonprj.changeip (); /// String [] iPlist = new string [] {" 192.168.0.253 "," 192.168.0.250 "}; /// String [] SubnetList = New String [] {" 255.255.255.0 ", 255.255.255.0"}; /// o.changeto (iPlist, SubnetList); /// code> /// summary> public change () {moc = mc.getinstances ();} ///
IOBJ = Mo.getMethodParameters ("enablestatic"); IOBJ ["ipaddress"] = ipaddr; IOBJ ["SubnetMask"] = SubnetMask; Oobj = Mo.invokeMethod ("Enablestatic", IOBJ, NULL);}}
///
iObj = mo.GetMethodParameters ( "SetGateways"); iObj [ "DefaultIPGateway"] = gateways; iObj [ "GatewayCostMetric"] = gatewayCostMetric; oObj = mo.InvokeMethod ( "SetGateways", iObj, null);}}
///
iObj = mo.GetMethodParameters ( "EnableStatic"); iObj [ "IPAddress"] = ipAddr; iObj [ "SubnetMask"] = subnetMask; oObj = mo.InvokeMethod ( "EnableStatic", iObj, null); iObj = mo.GetMethodParameters ( "Setgateway"); iobj ["defaultgateway"] = Gateways; IOBJ ["GatewayCostMetric"] = GatewayCostMeTric; OOBJ = Mo.invokeMethod ("setgateways", IObj, null;
Iobj = mtMethodparameters ("setDnsserversearchOrder"); IOBJ ["DNSSERVERSEARCHORDER"] = DNSSERVER; OOBJ = Mo.invokeMethod ("setDnsserversearchOrder", IObj, null);}}
///
IF (! "" "DHCPENABLED"]) {iobj = mtMethodParameters ("enabledhcp"); OOBJ = Mo.invokeMethod ("enabledHCP", IOBJ, NULL);}}}}}