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

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

1 Answer 1

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.