Steps to restore deleted Active Directory DNS using PowerShell

The following is a comparison between restoring a deleted AD DNS Zones with Windows PowerShell and RecoveryManager Plus.

Windows PowerShell

Prerequisite: The native Recycle Bin in Active Directory has to be enabled.

To restore the DNS Zone and all its child objects,

Identify the GUID of the deleted DNS Zone by executing the following script.

Get-ADObject -Filter {name -like "..Deleted-ADRecycleBin.dir*"} -IncludeDeletedObjects -SearchBase "DC=DomainDnsZones,DC=%mydomain%,DC=com"

Where %mydomain% is the name of your AD domain.Copy the GUID.

Click to copy the script

Restore the DNS Zone by running the following script.

Get-ADObject -Filter 'isdeleted -eq $true -and msds-lastKnownRdn -eq "..Deleted-ADRecycleBin.dir"' -includedeletedobjects -searchbase "DC=DomainDnsZones,DC=%mydomain%,DC=com" | Restore-ADObject
Click to copy the script

Execute the following script with the GUID to restore the DNS child objects.

.\scriptfilename.ps1 -identity <GUID-here> -partition "DC=DomainDnsZones,DC=%mydomain%,DC=com"
Click to copy the script

RecoveryManager Plus

To restore the DNS Zone and all its child objects,

  • Navigate to Active Directory tab > Recycle Bin.
  • Select the deleted DNS Zone and click Restore.

And voila! The DNS Zone and all its child objects are restored.

Screenshot

Restore DNS

» Start 30-day Free Trial

Following are the limitations in restoring AD DNS Zones using Windows PowerShell:

  • The native AD Recycle Bin has to be enabled for restoration using PowerShell to work. Once the native Recycle Bin has been enabled, it cannot be disabled. On the other hand, RecoveryManager Plus's Recycle Bin does not require the native Recycle Bin to be enabled.
  • The DNS child objects are not restored automatically when the Zone is restored whereas in RecoveryManager Plus, restoring the DNS Zone automatically restores all DNS child objects too.

Overcome the limitations of PowerShell by using
RecoveryManager Plus to restore deleted objects.

  •  
     
  •  
  • By clicking 'Download now', you agree to processing of personal data according to the Privacy Policy.

Thank you for downloading!

Your download should begin automatically in 15 seconds. If not, click here to download manually.

  • Embark on your script-free AD Self-service password management with ADSelfService Plus.
  •  
  • By clicking 'Get your free trial now', you agree to processing of personal data according to the Privacy Policy.
  • Thank you for downloading!

    Your download should begin automatically in 15 seconds. If not, click here to download manually.

Related Resources

A single pane of glass for Active Directory, Azure Active Directory,
Microsoft 365, Google Workspace, and Exchange Backup.
  • » Personal WorkDrive backup
  • » Backup retention
  • » Incremental backup