Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

For example:

IPs present on server: Initially configured statically with, it had two additional IPs added to the same NIC, and
A Record for points at

When pinging from another machine returns the proper IP of Tracert shows going through the proper channels.

When pinging when on returns Tracert shows it not going to DNS and resolves on the server to the lowest numerical IP.

Is there any solution for this occuring? I'm trying to write a script that will run on the server and return the IP that was configured as the static IP on the NIC properties.

Using a WMI class, I am able to see all the IPs on that NIC, so until now I have been assuming the first item in the array was what was configured, but ideally would rather just reach out to DNS to get the IP.

Any suggestions?

share|improve this question

It sounds like you have two conflicted expectations here. On the one hand, you seem to expect it to make a DNS query. On the other hand, you want to show the "P that was configured as the static IP on the NIC properties". It is possible to get conflicting information from those two items.

Lacking more information, I'll just point you on using the DNS record. The way to do that is to explicitly ask the DNS server:

PS> [System.Net.Dns]::GetHostAddresses("")

And if you don't know the fully-qualified hostname at the time of building the script, use this in place of the server name:

share|improve this answer
To explain myself a bit more, the static IP configured on the NIC properties IS the IP that is configured as the A record for the hostname. When I use command you suggested, it returns an array of objects which contain the 3 IPs configured on the server, in this order (,, It isn't reaching out to DNS to get the response. – Jared Jan 22 '13 at 19:54
I ended up just writing a small Powershell script that will query and parse nslookup to make the output usable elsewhere in my script. – Jared Jan 24 '13 at 16:49

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.