Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Domain Controller DNS Records – Clean up with Powershell

by | Jan 6, 2021

Domain Controller DNS Records can be cleaned up with Powershell.

At Bobcares, we often handle similar requests from our customers as part of Server Management Services.

Today let’s see how our Support Engineers do this with the help of Powershell.

How to Clean up Domain Controller DNS Records?

One method that our Support Techs follow is to clean up Stale/Dead Domain Controller records by using PowerShell.

We know that Windows 7 and all orther later version usually have PowerShell.

 

 domain controller dns records

 

Steps to follow are given below:

1. First, we create an array of all the records in the zone _msdcs.bob.com:

$dnsrecords = Get-DnsServerResourceRecord -ZoneName “_msdcs.bob.com”

The data we filter is part of the ‘RecordData’ data column which is inside an array and an array of data itself.

2. Next, we can separate the Domain Controller(DC) for clean up. And for doing this we have to filter the resulting data

We can filter this data depending upon some of the attributes such as IPv4Address, NameServer, and DomainName which are available in the RecordData recordset.

$deadDC = $dnsrecords | Where-Object {$_.RecordData.IPv4Address -eq “192.168.50.15” -or $_.RecordData.NameServer -eq “DC02.bob.com.” -or $_.RecordData.DomainName -eq “DC02.bob.com.”}

3. Once this is complete we have all the DNS records for dead Domain Controller in an array.

Usually, it is easy to delete them all. And this can be done simply by calling the Remove-DnsServerResourceRecord cmdlet against the array and the zone.

$deadDC | Remove-DnsServerResourceRecord -ZoneName “_msdcs.bob.com” -whatif

4. We must ensure that we do not delete anything of relevance.  All we have to do is simply remove the ‘whatif’  since this will delete the record.

Generally, after doing this there will not need a manual clean-up.

So, can bring all those components into one command to get the following result:

Get-DnsServerResourceRecord -ZoneName “_msdcs.bob.com” | `Where-Object {$_.RecordData.IPv4Address -eq “192.168.50.15” ` -or $_.RecordData.NameServer -eq “DC02.bob.com.” -or `$_.RecordData.DomainName -eq “DC02.bob.com.”} | Remove-DnsServerResourceRecord -ZoneName “_msdcs.bob.com” -force

[Need assistance to clean up domain controller records? We can help you!]

Conclusion

To conclude, we saw how our Expert Support Engineers clean up Stale/Dead DC DNS records with the help of PowerShell.

Also, we saw how easy it is to clean up domain controller records with the help of this method using few Windows PowerShell commands.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF