Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible, with WMI, to bind IP addresses to a NIC? I have been able to enable a static IP, but I can't seem to find any information on adding additional IPs.

this code helped and after I realized that the IP address and Subnet fileds were arrays it made more sense:

Basically, when you assign the IPs and subnets you separate the different items with commas so:

newIP["IPAddress"] = new string[] { "", ""}; 
newIP["SubnetMask"] = new string[] { "",""}; 
share|improve this question

I assume you are using the EnableStatic method of the Win32_NetworkAdapterConfiguration class to assign a static IP?

If so, the MSDN documentation refers the the IP address and gateway parameters as lists, perhaps you can use arrays to assign multiple addresses?

Sorry, I don't have easy access to a Windows machine I can test with at the moment. Maybe later when I'm at home.

share|improve this answer
I am using hte EnableStatic method. I tried an array of IP addresses, but it donesn't seem to work or I am doing something wrong. – DDiVita Sep 14 '10 at 16:00
Can you edit your question and add the code you're using? I'll install a Windows VM quickly. – ThatGraemeGuy Sep 14 '10 at 18:09
The reason why it wasn't working is that I had DHCP enabled on a machine I was testing. I never set it to use a Static address via the code. I thought WMI would automatically do that, but apparently it doesn't. – DDiVita Sep 15 '10 at 11:58
I'm confused, do you still have a problem, or is it working properly now? – ThatGraemeGuy Sep 15 '10 at 12:57
up vote 0 down vote accepted

Check out my updates in my origianl post.

share|improve this answer
$IPs = ($NIC.IPAddress)
$mask = @()
foreach($ip in $IPs) {$mask += ""}
$NIC.EnableStatic($ips, $mask)

Try this

share|improve this answer
Please don't just write a string of commands without any context or explanation. It's hard for others to make an informed decision as to whether the answer is correct or not. – Jenny D Sep 15 '15 at 15:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.