The Simplest way of removing a DNS record from your active directory is using WMI. With Server 2008 R2 you can use powershell to get the record by setting a filter for the domainname and pipe the object to the wmiobject remove routine like this:
1 2 |
'WMI Query - DNS Remove Windows 2008 R2 Server - Powershell Example Get-WmiObject -ComputerName [YourAD-DNSServer] -Namespace 'Root\MicrosoftDNS' -class MicrosoftDNS_AType -Filter "domainname = '[E.G.:YourComputerName]'" | remove-wmiobject |
There are several online solutions available, but most of them use the wrong namespace and wrong filter parameter. This one workls perfectly. Ensure that you are using an administrative powershell with domainadmin privileges.