Can't get Get-DnsServerResourceRecord to return records

Welcome Forums General PowerShell Q&A Can't get Get-DnsServerResourceRecord to return records

This topic contains 8 replies, has 3 voices, and was last updated by

 
Participant
3 weeks, 4 days ago.

  • Author
    Posts
  • #112781

    Participant
    Points: 0
    Rank: Member

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

  • #112783
    Jon

    Participant
    Points: 2
    Rank: Member

    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?

    • #112795

      Participant
      Points: 0
      Rank: Member

      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?

    • #112798

      Participant
      Points: 37
      PublishedHelping Hand
      Rank: Member

      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.

    • #112804

      Participant
      Points: 0
      Rank: Member

      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      
  • #112822
    Jon

    Participant
    Points: 2
    Rank: Member

    https://docs.microsoft.com/en-us/powershell/module/dnsserver/get-dnsserverresourcerecord?view=win10-ps

    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!

    • #112847

      Participant
      Points: 0
      Rank: Member

      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?

  • #112849
    Jon

    Participant
    Points: 2
    Rank: Member

    Correct

    You have to have the minimum supported operating system.

    • #112852

      Participant
      Points: 0
      Rank: Member

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

      Thanks everyone

You must be logged in to reply to this topic.