Get-DnsServerResourceRecord fails on DNS server

I try running basic record lookup directly on a Windows server 2012 R2 DC as such:

Get-DnsServerResourceRecord -ZoneName '' -ComputerName

and get error:

Get-DnsServerResourceRecord : Failed to get the zone information for on server

I know the Zone exists and the record does exist as well. Why is this DNS cmdlet failing to retrieve the info?


You might have misunderstood the syntax for this cmdlet. If I got you right you meant something like this:

Get-DnsServerResourceRecord -ZoneName ‘’ |
Where-Object {$_.HostName -like ‘’}

I actually just copied the code out of Richard Siddaway’s book AD Management in a Month of Lunches

It’s on page 214 section 15.3.1


 The -ComputerName parameter on this cmdlet is looking for the name of your DNS server. Perhaps you are supplying the name of the record you are searching for? Try something like this
$splat = @{
Name = 'hostname'
ComputerName = 'DNSserverName'
zoneName = 'ZoneName'

Get-DnsServerResourceRecord @splat

I don’t know what to say. I don’t have the book. Did you try it? Did it work?

Thanks for the catch L-bo. To be fair, on the next page Siddaway does state that the -ComputerName parameter is indeed the name of the DNS server. I changed my test one liner, as well as ran your snippet of code and both work.

thanks again.

Hey Jeff, Just to add here. Whenever the cmdlet you are running gives you an error like this, look in the inbuilt help system for PowerShell. If you haven’t done so already run an elevated PowerShell prompt and run Update-Help. This will grab any help the system can find for any modules you have on your system that have updateable help.

Once that is done run Help

help Get-DnsServerResourceRecord -ShowWindow
this will pop open a separate window with the full help for that cmdlet, parameters and what each param does and more importantly its examples.

Glad you got it resolved. I was sure the example worked :slight_smile:

Thanks Richard. Love your work