Remove-DnsServerResourceRecord : Failed to get RRS feed

  • Question

  • Hi all, I have a script that should be deleting PTR records, but it is sending back the error message:

    "Remove-DnsServerResourceRecord : Failed to get r-temp.eng.com. record in 144.6.10.in-addr.arpa zone on corp-dns server."

    Here is the script:

    $OutFile = "C:\Test\ReverseLogFile.csv"

    $zones=Get-WMIObject -computername "corp-dns" -Namespace Root\MicrosoftDNS -Class "MicrosoftDNS_Zone" | ? { $_.ContainerName -Notlike '..RootHints' -And $_.ContainerName -NotLike '..Cache' -notlike !$_.Reverse } | Select Name

    foreach ($zone in $zones){
        $ipget=gwmi -Class MicrosoftDNS_PTRType -NameSpace Root\MicrosoftDNS -ComputerName corp-dns  -Filter "DomainName = '$zonename' AND TimeStamp = 0" | Select-Object -property Ownername, RecordData, Timestamp   
    foreach ($ipname in $ipnames){
        #write-host $ipform "ipform"
        if (Test-Connection -ComputerName $ipform -count 2 -ErrorAction SilentlyContinue){
                Write-Host "$ipform, $name, Up and Running"
                Write-Output "$ipform, $name, Up and Running" | Out-File $OutFile -Append
                Write-Host $counth, "counth"                                                                                   }
                Write-Host "$ipform, $name, Host down - deleting PTR Record"
                Write-Output "$ipform, $name, Host down - A Record deleted." | Out-File $OutFile -Append
                Remove-DnsServerResourceRecord -zonename "$zonename" -ComputerName corp-dns -RRType PTR -Name $name -Force

    Can anyone point out why I keep getting this error?  TIA

    • Moved by Bill_Stewart Thursday, January 25, 2018 9:57 PM This is not "fix/debug/rewrite my script for me" forum
    Tuesday, September 5, 2017 6:59 PM

All replies

  • A record with that name does not exist.  You cannot reference a non-existent record.


    Tuesday, September 5, 2017 7:16 PM
  • It's actually there. I've tried deleting it with both FQDN and just the hostname. Both give the same results.
    Tuesday, September 5, 2017 7:20 PM
  • See: https://rcmtech.wordpress.com/2014/02/26/get-and-delete-dns-a-and-ptr-records-via-powershell/

    If your DNS is corrupted then this may fail and you will have to manually try to delete the records or rebuild the zone.


    Tuesday, September 5, 2017 7:23 PM
  • So I removed all of the old DNS records, and re-added them - I'm still getting the error message. What else could it be?
    Tuesday, October 31, 2017 9:07 PM
  • What is the issue.  Did you try to delete the record manually?


    Tuesday, October 31, 2017 9:47 PM
  • I can delete the PTR record manually, but there are over 200 records to delete, so I built the PowerShell script. It's throwing the error, "Remove-DnsServerResourceRecord : Failed to get daniel.corp.xxx.com. record in 1.168.192.in-addr.arpa zone on DNSServer server." TIA
    Tuesday, October 31, 2017 10:19 PM
  • Anything?

    Monday, November 6, 2017 7:03 PM