# Can't get Get-DnsServerResourceRecord to return records

**URL:** <https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386>\
**Category:** PowerShell Help\
**Created:** [September 26, 2018, 11:52am UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386 "2018-09-26T11:52:14Z")\
**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:** [September 26, 2018, 11:52am UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/1 "2018-09-26T11:52:14Z")

</div>

I’m trying to work with the DNSServer module and am on a Utility server that has access to our DC (DCS001).

My Utility server has Powershell 5.1 installed and I see all of my DNS cmdlets. I can also load up the dnsmgmt.msc snapin and view DCNS records for all domains

But when I simply attempt to run:

```
Get-DnsServerResourceRecord -ComputerName “DCS001” -ZoneName “[corp.com](http://corp.com)” -RRType A
```

…I get and error

```
Get-DnsServerResourceRecord : Invalid namespace
```

What am I missing? I’ve tried various other Zones for the -ZoneName parameter but same error.

Thank you

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [September 26, 2018, 12:01pm UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/2 "2018-09-26T12:01:15Z")

</div>

Works fine for me from my admin server to the DC.

I would be inclined to think it’s a connection issue between your utility server and the DC. Looks like that cmdlet might use CIM as the connection, can you start a PS Session to the DC?

What OS is your utility server, what OS is the DC?

---

<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:** [September 26, 2018, 3:50pm UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/3 "2018-09-26T15:50:59Z")

</div>

Utility server: Server 2008 R2 (PS v 5.1)  
Domain Controller: Server 2008 R2 (PS v 4)

I was able to start a New-PSSession to the DC. Can’t run DNSServer cmdlets there however because it’s only PS 4 ?

But shouldn’t I be able to run DNSServer cmdlets from my Util server that already has them loaded?

---

<div class="post-metadata">

**Author:** ![postanote](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@postanote](https://forums.powershell.org/u/postanote)\
**Post date:** [September 26, 2018, 4:22pm UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/4 "2018-09-26T16:22:47Z")

</div>

You must implicitly or explicitly connect to a server with the DNS role or the RSAT DNS tools loaded.  
PSv4 is not the issue. As noted the result form one of my DNS servers WS2012R2 running PSv4.

```
(Get-CimInstance -ClassName Win32_OperatingSystem).Version
6.3.9600

($PSVersionTable).PSVersion.Major
4

Get-WindowsFeature -Name '*DNS*'

Display Name Name Install State
------------ ---- -------------
[X] DNS Server DNS Installed
        [X] DNS Server Tools RSAT-DNS-Server Installed

Get-DnsServerResourceRecord -ComputerName $env:COMPUTERNAME -ZoneName $env:USERDNSDOMAIN -RRType A

HostName RecordType Timestamp TimeToLive RecordData
-------- ---------- --------- ---------- ----------
@ A 4/8/2017 ...                                    
@ A 9/25/2018 ...                                      
adfs A 0 ...                                    
DomainDnsZones A 9/25/2018 5...                                      
ForestDnsZones A 9/25/2018 ...                                     
..
```

If you know the all the above DNS host is valid and they are still not running, then you have somehtinbg else working against you in your environment.

---

<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:** [September 26, 2018, 5:21pm UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/5 "2018-09-26T17:21:07Z")

</div>

My Util server has the following:

```
(Get-CimInstance -ClassName Win32_OperatingSystem).Version

6.1.7601

($PSVersionTable).PSVersion.Major

5

Get-WindowsFeature -Name '*DNS*'

Display Name Name                   
------------ ----                   
[] DNS Server DNS                    
        [X] DNS Server Tools RSAT-DNS-Server
```

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [September 27, 2018, 6:02am UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/6 "2018-09-27T06:02:09Z")

</div>

> **[Get-DnsServerResourceRecord (DnsServer)](https://docs.microsoft.com/en-us/powershell/module/dnsserver/get-dnsserverresourcerecord?view=windowsserver2022-ps&viewFallbackFrom=win10-ps)**
>
> Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.

If you click “Windows 10 and Windows server…” in the top left hand corner of the above link you will see that it lists 2012 as the minimum operating system for it to work.

I am sure you are aware 2008R2 is end of life in 14 months, time to start upgrading!

---

<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:** [September 27, 2018, 11:04am UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/7 "2018-09-27T11:04:18Z")

</div>

yeah I’m sure the team is upgrading those servers’ OS’s (I’m a contractor).

So, even if my Utility server has the latest PS, and the DNSServer module loads, and I use the -ComputerName parameter to point to a DC with DNS records, I still won’t get records returned?

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [September 27, 2018, 11:25am UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/8 "2018-09-27T11:25:32Z")

</div>

Correct

You have to have the minimum supported operating system.

---

<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:** [September 27, 2018, 1:23pm UTC](https://forums.powershell.org/t/cant-get-get-dnsserverresourcerecord-to-return-records/11386/9 "2018-09-27T13:23:13Z")

</div>

ok I see now. I tried on a 2012 DC and see results,

Thanks everyone

---

<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/cant-get-get-dnsserverresourcerecord-to-return-records/11386/10 "2024-05-16T20:34:20Z")

</div>

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


