Networking Forums

Networking Forums > Computer Networking > Windows Networking > c# WMI EnableStatic fails on Vista with error" 84 – IP not enabled

Reply
Thread Tools Display Modes

c# WMI EnableStatic fails on Vista with error" 84 – IP not enabled

 
 
Megha
Guest
Posts: n/a

 
      11-04-2008, 07:04 PM
I need to be able to configure the adapter when it is not connected to any
device.(has no link light on it) I am using following
method(WMI-enableStatic) to assign static IPaddress to selected NIC.

It works on XP but returns an error code “ 84 – IP not enabled” on Vista OS.

I have a peer-peer connection with device. The following call works on
Vista as well if device is powered on (I have link light on NIC) . Is there a
way I can assign adapter a static IP address that it can use at later time
when device is up and running ?

Any help/ pointer will be appriciated.
Thanks in advance,
Megha

public static void SetIPAdress(string macID, string IPAddress, string
SubnetMask)
{
ManagementObjectSearcher query = new
ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration
WHERE IPEnabled = 'TRUE'");
ManagementObjectCollection objMOC = query.Get();

int ManagementObjectCount = 0;
foreach (ManagementObject objMO in objMOC)
{
ManagementObjectCount++;
try
{
string macAddr = (string)objMO["MACAddress"];
if (string.Compare(macAddr, macID) == 0)
{
ManagementBaseObject objNewIP = null;
ManagementBaseObject objSetIP = null;
objNewIP = objMO.GetMethodParameters("EnableStatic");
objNewIP["IPAddress"] = new string[] { IPAddress };
objNewIP["SubnetMask"] = new string[] { SubnetMask };
objSetIP = objMO.InvokeMethod("EnableStatic",
objNewIP, null);
}
}
catch (Exception ex)
{
log.InfoFormat("SetIPAdress failed to set IP : " +
ex.Message);

}

}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continuation of "Arrrgh! rsync "chroot failed" error message!" kenney@lucent.com Linux Networking 3 08-10-2006 08:35 AM
"Netsh Int show Int" always shows interfaces admin enabled Stockner Windows Networking 0 06-28-2005 08:18 PM
Help! Ipsec-tools/Racoon link through NAT .. "ip route" fails Sundial Services Linux Networking 12 11-28-2004 06:33 PM
"IC (Incoming Connections) is currently enabled ... To configure RRAS, please disable IC and try again." Jon Davis Windows Networking 3 10-12-2004 02:07 AM
"pon" fails and gives "ttyS overrun" in syslog Al Hayes Linux Networking 7 07-07-2004 11:22 PM



1 2 3 4 5 6 7 8 9 10 11