Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

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

Posted on 21/11/202030/08/2026 Christian By Christian No Comments on Restore AD Objects: How to restore deleted user accounts in Active Directory with Microsoft LDP and PowerShell
  1. Home
  2. Windows Server
  3. 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. 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“.

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.

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

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”.

Interface for LDAP bind configuration, showing fields for user, password, and domain with options for bind type and an 'OK' button highlighted.

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.

User interface displaying settings for controls with options for Object Identifier, Value, Control Type, and a list of Active Controls, including a deprecated Policy hints control.

– Click on OK.

User interface displaying control settings with options for object identifier, value selection, control type, and predefined load options including 'Return deleted objects'.

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

Screenshot of an LDAP viewer interface showing the 'View' menu with 'Tree' option highlighted, and an error message displayed on the right side.

Enter the “Distinguished name” as shown below and

CN=Deleted Objects,DC=domain,dc=com
Pop-up window displaying a Tree View with a BaseDN input field showing 'CN=Deleted Objects,DC=techdirectarchive,dc=local' and an 'OK' button highlighted.
Screenshot of an LDAP query interface displaying a directory structure, including error messages and matched distinguished names related to 'Deleted Objects' and 'techdirectarchive.local'.

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

Menu options displayed in a software interface, highlighting the 'Modify' option for managing directory entries in a Windows environment.

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

A user interface displaying a Modify window, featuring options to delete an entry with the attribute 'IsDeleted'. The 'Delete' option is highlighted, and an 'Enter' button is shown.
A screenshot of a Modify Entry dialog box used in directory services, displaying fields for DN, attribute, values, operation options (Add, Delete, Replace), and an entry list for the IsDeleted attribute setting.

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

Screenshot of a software interface displaying the 'Modify' dialog with options to edit LDAP entries. Key elements include fields for DN, Edit Entry Attribute, Values, and an operation selection with options to Add, Delete, or Replace. Checkboxes for 'Synchronous' and 'Extended' are also visible.

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.

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.

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

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
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

  • create a two way Active Directory Trust
    How to create a two-way Active Directory Trust Windows Server
  • screenshot 2020 02 08 at 20.02.50
    Windows 10 Administrative Shortcut command key Windows Server
  • maxresdefault
    The following errors occurred attempting to join the domain: The specified domain either does not exist or could not be contacted Windows Server
  • How to Manage Azure Virtual Machines with Windows Admin Center and Serial Console​
    Manage Azure Virtual Machine with Windows Admin Center and Serial Console AWS/Azure/OpenShift
  • MachineAccountQuota
    Change the number of MachineAccountQuota a user can add to AD Windows Server
  • How to Convert a Distribution Group to a Security Group
    How to convert distribution group to security group Windows Server

More Related Articles

Slide1 4 How to create and configure a Shared Folder on Windows Server Windows Server
v13 harding Veeam Hardening Your Infrastructure: A Guide to VMware VBS and MS GPO Credential Guard in VBR v13 Backup
VMware workstation networking issues Network cable Unplugged: Fix VMware “Warning – Multiple default gateways are intended to provide redundancy to a single network Virtualization
article 1280x720.192a2586 1 1 No valid offer received: WDS PXE-E16 error when booting clients Windows Server
Screenshot 2020 08 28 at 12.51.10 The service could not be started either because it is disabled or because it has no enabled devices associated with it Windows Server
update powershell in Windows Upgrade PowerShell Core Windows or Mac and Linux System Windows

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

vexpert-badge-stars-5

Virtual Background

VEEAMLEGEND

Categories

Top 30 Sysadmin blog

veeaam100

Veeam Vanguard

  • AADSTS900144
    Fix AADSTS900144: The request body must contain the parameter Linux
  • DC Name
    Install and configure Active Directory Domain Services on Windows Server Windows
  • banner
    How to Back Up and Restore the Windows Registry Windows
  • img 5be0c6cdb96d8
    Is BitLocker Enabled? How to view BitLocker Disk Encryption Status in Windows Windows
  • unnamed
    Upgrade ManageEngine Password Manager Pro Password Manager
  • speedtest
    How to set up a self-hosted speed test server on Ubuntu Linux Linux
  • Windows OS type and version and build
    How to determine Windows Version or Edition and Build Windows
  • MFA
    Rolling out Multi-factor Authentication – Recommendations Security | Vulnerability Scans and Assessment

Subscribe to Blog via Email

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

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

Tags

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

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.