Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Wed, 30 Jul 2008 23:36:01 -0700,    group: microsoft.public.win32.programmer.wmi        back       


Enablestatic function fails with errorcode 84   
Hi,

I am facing this problem of setting the IP address on the Public Ethernet 
adapter(of Intel Series). The OS is Windows 2003 server SP2. The EnableStatic 
function fails with return code 84. I tried a lot to figure out the problem 
but in vain.

Any help in this regard will be highly appreciated!!
date: Wed, 30 Jul 2008 23:36:01 -0700   author:   Alfonso68

c#- WMI - EnableStatic fails with error code 84 -"IP not enabled"   
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);

                }

            }
        }
date: Tue, 04 Nov 2008 12:51:58 -0800   author:   Megha Biyani

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us