# Get-DnsServerResourceRecord fails on DNS server

**URL:** <https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916>\
**Category:** PowerShell Help\
**Created:** [July 2, 2018, 4:50pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916 "2018-07-02T16:50:22Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [July 2, 2018, 4:50pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/1 "2018-07-02T16:50:22Z")

</div>

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

```
Get-DnsServerResourceRecord -ZoneName 'mycorp.com' -ComputerName lvsp01rwt002.mycorp.com
```

and get error:

```
Get-DnsServerResourceRecord : Failed to get the zone information for[mycorp.com](http://mycorp.com)on server[lvsp01rwt002.mycorp.com](http://lvsp01rwt002.mycorp.com).
```

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

Thanks

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 2, 2018, 4:58pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/2 "2018-07-02T16:58:37Z")

</div>

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

```
Get-DnsServerResourceRecord -ZoneName ‘[mycorp.com](http://mycorp.com)’ |
Where-Object {$_.HostName -like ‘_[lvsp01rwt002.mycorp.com](http://lvsp01rwt002.mycorp.com)_’}
```

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [July 2, 2018, 5:10pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/3 "2018-07-02T17:10:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bo1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/bo1/32/33_2.png) [@bo1](https://forums.powershell.org/u/bo1)\
**Post date:** [July 2, 2018, 5:12pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/4 "2018-07-02T17:12:11Z")

</div>

Jeff,

```
 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
```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 2, 2018, 5:12pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/5 "2018-07-02T17:12:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [July 2, 2018, 5:37pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/6 "2018-07-02T17:37:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alex-aymonier](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@alex-aymonier](https://forums.powershell.org/u/alex-aymonier)\
**Post date:** [July 2, 2018, 5:52pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/7 "2018-07-02T17:52:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![richard-siddaway](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@richard-siddaway](https://forums.powershell.org/u/richard-siddaway)\
**Post date:** [July 3, 2018, 6:21am UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/8 "2018-07-03T06:21:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [July 3, 2018, 4:13pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/9 "2018-07-03T16:13:45Z")

</div>

Thanks Richard. Love your work

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/get-dnsserverresourcerecord-fails-on-dns-server/10916/10 "2024-05-16T20:34:47Z")

</div>

Closed on May 16, 2024, 8:34pm UTC


