Get DNS IP remotely - Script
-
Wednesday, December 05, 2012 3:35 PM
Hello,
I need an script to get the DNS IP (the primary one) of my PCs remotely, for example using "psexec" command.Is there any way to get it remotely ?Thanks in advance,Roger JC
All Replies
-
Wednesday, December 05, 2012 3:41 PMModerator
Hi,
Why do you need to do it? Are the computers not getting assigned DNS server IP addresses via DHCP?
Bill
- Proposed As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Monday, December 10, 2012 7:27 PM
- Marked As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Tuesday, January 22, 2013 8:38 PM
-
Wednesday, December 05, 2012 4:34 PM
Hello,
I need an script to get the DNS IP (the primary one) of my PCs remotely, for example using "psexec" command.Is there any way to get it remotely ?Thanks in advance,Roger JCThe DNS IP? What is that.
So you can get a better idea of why your request is vague and untechnical read teh following.
If your computer is registered in DNS then a simple ping will get you the DNS IP.
IF you are talking about a DNS lookup of a computer by name the use NSLOOKUP
NSLOOKUP <enter>
somepcnameThis will return the IP from the current DNS resolver for the requested name.
If you want a direct remote lookup then use WMI which can remotely query a DNS server for irts full records. You must be an admministrator on the DNS server to do this.
DNSCMD can remotely retrieve DNS records.
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Wednesday, December 05, 2012 4:35 PM

