Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Windows Server » Restore AD Objects: How to restore deleted user accounts in Active Directory with Microsoft LDP and PowerShell
  • Smartscreen defender blocking application
    Unable to run downloaded Programs due to Defender SmartScreen Windows
  • VBR upgrade
    Upgrade Veeam Backup and Replication to version 12.2 Backup
  • image 10
    How to use Microsoft SQL Server Management Studio to Export and Import your MsSQL database from Azure to local computer AWS/Azure/OpenShift
  • Was ist Windows Server und wie unterscheidet er sich vom normalen Windows
    Create a certificate template for BitLocker Network Unlock Windows Server
  • MicrosoftOneDrive32
    Microsoft OneDrive Setup: Files On-Demand & Key Features Backup
  • Feature image DEP
    Disable Data Execution Prevention and determine that hardware DEP is available and configured Security | Vulnerability Scans and Assessment
  • Setup FSx File System 1
    Create and mount FSx File System: Join EC2 instance to AWS Managed AD AWS/Azure/OpenShift
  • fix this PC cannot run on Windows
    How to Fix “This PC Can’t Run Windows 11” on Hyper Windows

Restore AD Objects: How to restore deleted user accounts in Active Directory with Microsoft LDP and PowerShell

Posted on 21/11/202009/09/2023 Christian By Christian No Comments on Restore AD Objects: How to restore deleted user accounts in Active Directory with Microsoft LDP and PowerShell
Restore AD Objects

Active Directory (AD) is a widely used directory system, the ability to restore unwanted changes in your AD infrastructure is crucial. When AD objects are deleted, they are placed in the Deleted Objects container (AD recycle bin). There are several methods to restore deleted user accounts, computer accounts, and security groups. These objects are known collectively as security principles. By default, this container is not displayed to an administrator and it must be enabled manually either using either PowerShell, ADAC, or via the LDP.exe utility. For some related content on Active Directory, see the following guides, “AD Authentication methods: Kerberos and NTLM, Concept of AD Computer Account, how to remove Microsoft Exchange Server from AD, and also “the sign-in method you are trying to use is not allowed”, and for a detailed list of articles on Active Directory, visit the following link“.

AD Recycle Bin starting in Windows Server 2008 R2 builds on the existing tombstone reanimation infrastructure and enhances your ability to preserve and recover accidentally deleted AD objects. When you enable AD Recycle Bin, all link-valued and non-link-valued attributes of the deleted AD objects are preserved and the objects are restored in their entirety to the same consistent logical state that they were in immediately before deletion, e.g., all group memberships and corresponding access rights that they had immediately before deletion, within and across domains. Active Directory Recycle Bin works for both AD DS and AD LDS environments

Windows Server Account Recovery Methods

Since we have discussed how this can be achieved with the AD Administrative Center, let us discuss other methods to restore deleted accounts in a windows server using LDP.exe utility and PowerShell cmdlets.

Method 1 – PowerShell ADOptionalFeature cmdlet: In order to demonstrate this with PowerShell, I would love to create an AD user account and then delete it afterward. Here are the steps below, see how to create a contact in AD.
– Launch the AD User and Computer
– Click on your OU and create the user account as shown below

deleted user accounts

Enter some random names you wish as shown below

Active Directory

Enter the password and decide on what properties you want and then click on Next

Microsoft LDP

Finally click on “Finish” to complete the account creation.

Restore AD Objects

Now, the account creation is complete. We can now proceed with the account deletion once more 🙂

Active Directory

Click on Yes to delete the account as shown below.

Microsoft LDP

Now the account has been deleted as it does no longer appear in the list as shown in the figure below.

PowerShell

Next, run the following PowerShell command to determine the GUID and the DN of the object that was deleted etc.

Get-ADObject -ldapFilter:"(msDS-LastKnownRDN=*)" – IncludeDeletedObjects
Restore AD Objects

Run the command given below in Windows PowerShell to restore the deleted object. As you can see, it makes sense to run the command above in order to determine the account name.

Get-ADObject -Filter 'Name -Like "*lab tester*"' -IncludeDeletedObjects | Restore-ADObject
Active Directory

As you can see, the account has been restored. This command will restore the object back to its previous location in the Active Directory after it is retrieved from the “Deleted objects container”.

Microsoft LDP

You can also use this PowerShell command below

Get-ADObject -Filter {displayName -eq "*lab tester*"} IncludeDeletedObjects | Restore-ADObject

If you wish to restore the object to a different OU, use the command below. You will have to enter each cmdlet as shown below in a single line, even though they may appear word-wrapped across several lines here because of formatting constraints See this link for more information.

Get-ADObject -Filter 'Name -Like "*lab tester*"' -IncludeDeletedObjects | Restore-ADObject -TargetPath "OU=users,DC=techdirectarchive,DC=local"

Method 2 – LDP.exe utility:

Ldp is a graphical user interface (GUI)-based tool with a scope pane on the left that is used for navigating through the Active Directory namespace, and a details pane on the right that is used for displaying the results of the LDAP operations. Moreover, LDP lets you perform connect, bind, search, modify, add or delete operations against AD. LDP is used to view objects stored in AD along with their metadata, and attributes.

Note: ldp.exe is available:
– On computers where the Domain Controller role has been installed.
– On computers where Remote Server Administration Tools (RSAT) has been installed.

To run LDP, perform the following steps
- From the Start menu or “Command Prompt”, 
- Type “ldp.exe” and press the “Enter” or "OK" key to start the ldp.exe utility.
Note: You can also call this from the command pormpt, just enter ldp.exe" and click on ok
Microsoft LDP

Select “Connect” from the “Connection menu” to show the “Connect” dialog box.

Restore AD Objects
Screenshot 2020 11 21 at 02.20.20
PowerShell
Screenshot 2020 11 21 at 02.20.34

Enter the server name (server’s IP address or Fully Qualified Domain Name (FQDN)) and default port number as 389.
– Click “OK” to establish the connection

deleted user accounts

if the current machine is located inside an Active Directory. Messages like the following will show in the right panel. This indicates that the connection has been established

Active Directory

To complete the connection with the Domain controller server, we will need to verify the existing user credentials.
– Click on the Connection menu again
– Select Bind as show below

Select the first option “Bind as currently logged on user” and
– Click “OK”.

Click on Controls under the Options menu as shown below

Select “Load Predefined” and click on the Return Deleted objects from drop-down list to access deleted objects.

– Click on OK.

Next, click on Tree” and on the “View” menu to access “Tree”.

Enter the “Distinguished name” as shown below and

CN=Deleted Objects,DC=domain,dc=com

Right-click the user and click “Modify” command to access the given dialog box

In “Edit Entry Attribute” type “IsDeleted” andsSelect “Delete” option and
– Click on “Enter”.

Next, type the distinguished name in the “Edit Entry Attribute” field as shown below.
– Select “Replace” under “Operation”.
– Also, ensure you select “Extended” checkbox.

This was the third option I tested because, the object will be restored to the root domain and cannot be restored to its original OU. After recovering the user object, you have to move the object to its parent container manually.

I do not find this feasible, with PowerShell and ADAC, you can restore back to its original OU and even specify a different OU to move it in.

Other tools capable of restoring AD objects:

There are many other tools out there that are capable of performing the same job function.
1: StealthRECOVER: This tool provides point-in-time rollback and recovery of Active Directory objects, attributes, Integrated DNS, and more, allowing organisations to restore objects in their entirety or just the granular attribute information they need.  In a nutshell, it allows you to roll back malicious or unwanted changes with a single click.

2: ADRestore Tool: This is a simple command-line utility that enumerates the deleted objects in a domain and gives you the option of restoring each one. Source code is based on sample code in the Microsoft Platform SDK. For more on SysInternal Tool, see the following link1 and link2.

3: Veeam: Veeam provides fast and reliable object‑level recovery for Active Directory from a single‑pass, agentless backup or storage snapshot without the need to restore an entire virtual machine (VM) or use third‑party tools.
– Search and restore for all Active Directory (AD) object types, such as users, groups, computer accounts, and contacts, including user and computer password recovery.

4: Lepide Data Security Platform: Also provides the capability to restore deleted Active Directory objects.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session. I welcome you to follow me on Twitter and Facebook.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Windows Server Tags:Active Directory, Active Directory Domain Services, deletion, PowerShell, PowerShell version 7, Restore

Post navigation

Previous Post: How to setup and configure a Lamp stack on CentOS
Next Post: How to setup PowerShell on a Linux server

Related Posts

  • fix this PC cannot run on Windows
    How to Fix “This PC Can’t Run Windows 11” on Hyper Windows
  • Missing ADML File
    Fix an appropriate resource file could not be found for LAPS Windows
  • MBAM Replacement
    MBAM extended support ends April 2026: Find alternative solution Security | Vulnerability Scans and Assessment
  • windows 10 desktop 1
    Active Directory Forest – Trees and Domain and Sites Windows Server
  • ACE magic
    How to install Windows Server unto ACEMAGICIAN Mini PC Windows Server
  • screenshot 2020 03 31 at 22.22.43
    How to create, edit and delete a scheduled task via the Command Prompt Windows Server

More Related Articles

fix this PC cannot run on Windows How to Fix “This PC Can’t Run Windows 11” on Hyper Windows
Missing ADML File Fix an appropriate resource file could not be found for LAPS Windows
MBAM Replacement MBAM extended support ends April 2026: Find alternative solution Security | Vulnerability Scans and Assessment
windows 10 desktop 1 Active Directory Forest – Trees and Domain and Sites Windows Server
ACE magic How to install Windows Server unto ACEMAGICIAN Mini PC Windows Server
screenshot 2020 03 31 at 22.22.43 How to create, edit and delete a scheduled task via the Command Prompt Windows Server

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a
 
  • Smartscreen defender blocking application
    Unable to run downloaded Programs due to Defender SmartScreen Windows
  • VBR upgrade
    Upgrade Veeam Backup and Replication to version 12.2 Backup
  • image 10
    How to use Microsoft SQL Server Management Studio to Export and Import your MsSQL database from Azure to local computer AWS/Azure/OpenShift
  • Was ist Windows Server und wie unterscheidet er sich vom normalen Windows
    Create a certificate template for BitLocker Network Unlock Windows Server
  • MicrosoftOneDrive32
    Microsoft OneDrive Setup: Files On-Demand & Key Features Backup
  • Feature image DEP
    Disable Data Execution Prevention and determine that hardware DEP is available and configured Security | Vulnerability Scans and Assessment
  • Setup FSx File System 1
    Create and mount FSx File System: Join EC2 instance to AWS Managed AD AWS/Azure/OpenShift
  • fix this PC cannot run on Windows
    How to Fix “This PC Can’t Run Windows 11” on Hyper Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,841 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.