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 record in 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