Steps to restore deleted Active Directory Computers using PowerShell

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

Windows PowerShell

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

To restore a deleted computer object with PowerShell

Identify the Distinguished Name (DN) of the computer object using the following script.

(Get-ADObject -SearchBase
(get-addomain).deletedobjectscontainer
-IncludeDeletedObjects
-filter "samaccountname -eq
'%OLD_NAME%'")
Where %OLD_NAME% is the sAMAccountName of the
computer object.
Click to copy the script

Once you get the DN of the computer object,
execute the following script.

Restore-ADObject -Identity $dn

Where $dn is the Distinguished Name of the computer object that you found out in the previous step.

Click to copy the script

RecoveryManager Plus

To restore a deleted computer object,

Navigate to Active Directory tab > Recycle Bin.

Select the deleted computer object and click Restore.

Screenshot

Restore compute poweshell

» Start 30-day Free Trial

The following are the limitations in restoring AD computer objects using Windows PowerShell:

  • It’s mandatory to know the sAMAccountName or the DN to perform any restoration using 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.
  • You can only restore computer objects to the last known state before they were deleted but with RecoveryManager Plus, you can choose to restore individual attributes of the computer objects to any of their previous state.

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