Steps to restore deleted Active Directory users using PowerShell

This article explains how to restore a deleted AD user account using PowerShell and RecoveryManager Plus, the Active Directory backup and recovery tool. The GUI-based RecoveryManager Plus makes it easy for any administrator to restore a deleted account in a few simple clicks, without having to write a single line of PowerShell script.

Windows PowerShell

Steps to restore deleted user objects using PowerShell:

  • Note: You have to enable Active Directory Recycle Bin before you can restore deleted objects using PowerShell. Once enabled, Recycle Bin cannot be disabled.
  • Step 1: Identify the distinguished name of the user object to be restored by executing the following PowerShell script.
  • Sample script:

    Set-ExecutionPolicy RemoteSigned
    (Get-ADObject -SearchBase (get-addomain).deletedobjectscontainer -IncludeDeletedObjects -filt er "samaccountname -eq '%OLD_NAME%'") | Restore-ADObject -NewName "$.Name"
    Click to copy the script
  • Step 2: Execute the following script to restore the deleted user object.
  • Sample script:

    Set-ExecutionPolicy RemoteSigned Restore-ADObject -Identity $dn
    Click to copy the script

RecoveryManager Plus

Steps to restore deleted user objects using RecoveryManager Plus:

  • Step 1: Navigate to Active Directory > Recycle Bin.
  • Step 2: Select the object you wish to restore and click Restore.

Screenshot

Restore deleted Active Directory

That’s all it takes. No PowerShell scripting. Easy, GUI-based point-and-click restore for user objects with advanced options such as advanced search and automatic membership restoration.

» Start your 30-day, free trial now.

Limitations of using PowerShell to restore deleted AD user accounts:

  • The native AD Recycle Bin has to be enabled for user restoration using PowerShell.
  • It is not possible to preview the properties of the user account before restoring it.
  • Multiple users cannot be restored simultaneously.
  • If the deleted user account was present in an OU which has also been deleted, the OU has to be restored before the user account can be restored.

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