Hi Mystique
Maybe you find the code below useful. It shows your IP-address. I didn't try
EnableStatic because I didn't find it practical to run the risk corrupting
my machine...
Christiaan.
ManagementClass mc = new
ManagementClass("Win32_NetworkAdapterConfiguration ");
ManagementObjectCollection moc = mc.GetInstances();
foreach(ManagementObject mo in moc)
{
Console.WriteLine("Description: {0}", mo["Description"].ToString());
if((bool)mo["IPEnabled"] == true)
{
string[] IPAddresses=(string[]) mo["IPAddress"];
for (int i=0;i<IPAddresses.Length;i++)
{
Console.WriteLine("+-> IpAddress {0} is:
{1}.",i.ToString(),IPAddresses[i]);
}
Console.WriteLine("+-> MAC address: {0}", mo["MacAddress"].ToString());
}
mo.Dispose();
}
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OX**************@TK2MSFTNGP15.phx.gbl...
Mystique,
You will want to use the classes in the System.Management namespace to
get the instance of the Win32_NetworkAdapterConfiguration WMI class that
corresponds to the adapter. Once you have that, you can call the
EnableStatic method on the instance to set the IP address for the adapter.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Mystique" <mi***@softhome.net> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl... Hi,
I have an application that needs to change the IP address of the local
computer.
How can I do this?
Regards,
Mystique