There you have it. # Following is all one line to comment. Hey there! If you have ever wondered about DNS Scavenging you need to read this Microsoft blog article. PowerShell; Virtualisation; Windows Server 2012; DNS Scavenging. DNS Server DNS Server Properties Forward Lookup Zones Reverse Lookup Zones Then via dnscmd.exe, set a scavenging server for every Forward and Reverse Lookup Zone This new script handles item number five. Below is the code $a = "DNS" #Your DNS Server Name $b = import-csv C:\Reverselookup.csv | select-object -expand ReverseLookup Foreach($Reverse in $b) { dnscmd $a /zoneadd $Reverse /DSprimary dnscmd /config $reverse /allowupdate 1 } CSV File name is REverselookup.csv Regards, _Prashant_ Windows DNS scavenging and record timestamp replication 20 - Next, lets create secondary zone by using Windows PowerShell. What I will do, is demonstrate an easy way to delete all DNS records related to a Domain Controller with a single PowerShell command. The scavenging period defines how often the server will try to scavenge records. By default the aging intervals of the DNS zone will be used, however a duration for the intervals can be chosen by passing a [TimeSpan] object to the -NoRefreshInterval and -RefreshInterval parameters. Replace "DCName" with the name of a Domain Controller and "ad.yourdomain.com" with your domain name: Get-DnsServerResourceRecord -ComputerName DCName -ZoneName "ad.yourdomain.com" -RRType "A" | Where {$_.TimeStamp.Year -eq 2017} This code will show DNS records older than 14 days: Open a Windows PowerShell prompt and run the following command to install the DNS Server role on SERVER2: . Once enabled create a new test record and enable it for scavenging. # PowerShell Source File # # AUTHOR: Stephen Wheet # NAME: dnsscavenge.ps1 # Version: 1.2 # Date: 8/12/10 # # COMMENT: # This script was created to manually scavenge DNS records for a given # period. PowerShell PS C:\> Get-DnsServerScavenging This command gets the scavenging settings for the local DNS server. On the General tab, click Aging, and then select the Scavenge stale resource records check box. We also provided a PowerShell script you can use to check the DNS Aging settings for all domain zones managed by the DNS Server. How to Fix Dynamic DNS Record Permissions in Active Directory In the first section, we define some variables, In the next section, we using wmiobject to get DNS information and we export this information into a csv file using export-csv powershell cmdlet. [System.Net.DNS]::GetHostEntry () uses the reverse lookup if we pass it an IP address; we're not going to .