• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
OpenTechTips

OpenTechTips

Comprehensive IT Guides for Pros and Enthusiasts

MENUMENU
  • HOME
  • ALL TOPICS
    • Exchange
    • InfoSec
    • Linux
    • Networking
    • Scripting
      • PowerShell
    • SSL
    • Tools
    • Virtualization
    • Web
    • Windows
  • ABOUT
  • SUBSCRIBE
Home » Restore AD Active Directory Object – Tombstone Reanimation

Restore AD Active Directory Object – Tombstone Reanimation

June 29, 2021 - by Zsolt Agoston - last edited on July 14, 2021

In this post we go through the process of restoring an accidentally deleted AD user account.

When an object is removed from Active Directory it's not gone forever, or at least not yet. AD has a retention policy to keep removed objects for a certain period of time - 180 days by default - before purging the object forever.

If Active Directory Recycle Bin is enabled, restoring the account is easy. We simply need to locate it and either use PowerShell or Active Directory Administrative Center to restore the account to it's pervious location with all the properties it had eariler.

However, if AD Recycle Bin is not enabled for the domain, restoring the account is still possible, although a little more cumbersome. This case after the AD account is deleted, it's converted to a tombstone container for the retention period. This tombstone object retains most of the account properties, like the SID, samaccount name, displayname, but some attributes will be lost. Those attributes are the UserPrincipalName, Firstname, Lastname, and so on.

To perform an AD object restore, we'll be using LDP.exe which can be found on any domain controllers in the domain.

Oops, the account is deleted!

In this example I delete the user account ''John Doe" and go through the steps of restoring it.

1. I push the Windows key and R together, type in dsa.msc and hit Enter.
2. There I locate the 'John Doe' user account, right-click on it and select 'Delete'.

Restore AD Active Directory Object – Tombstone Reanimation

Restore the deleted AD User account

1. First, open ldp.exe from an elevated command prompt. Right-click on the Windows button, and select either the Command Prompt (Admin) or the Windows PowerShell (Admin) option. There, type in ldp.exe and hit Enter.

Restore AD Active Directory Object – Tombstone Reanimation

2. In Ldp click on Connection / Bind, then select Bind as currently logged on user. Click OK.

Restore AD Active Directory Object – Tombstone Reanimation

3. Next, click on Options / Controls in the upper menu bar. Select the Return deleted objects from the Load Predefined drop-down menu. Click OK.

Restore AD Active Directory Object – Tombstone Reanimation

4. Now we are back to the main ldp.exe window. Click View / Tree in the menu. In the drop-down menu, select the distinguished name of the domain. In our case it's protectigate.com, so the distinguished name is DC=protectigate,DC=com

Restore AD Active Directory Object – Tombstone Reanimation

5. Expand the domain by douple clicking on its name in the left side menu. Locate and expand the CN=Deleted Objects container. Our deleted account will likely be located at the end of the list so scroll down until you find it. Here we are looking for John Doe.

Restore AD Active Directory Object – Tombstone Reanimation

6. Right-click on the object, and select Modify.
In the Attribute box type in isDeleted, set the Operation radio button to Delete, and click on the Enter button.

Restore AD Active Directory Object – Tombstone Reanimation

7. In the next step you'll need the distinguished name of the deleted object. If you are not sure what it was, a little PowerShell action will help.
Open an elevated PowerShell (click on the Start menu, then type in PowerShell, right-click on it and select Run as Administrator) window, and type in the following command. If you have a user with a different name, use that name in the command. This will return the distinguished name we need.

PS C:\> $DeletedUser = Get-ADObject -Filter {Name -like "John Doe*"} -IncludeDeletedObjects -Properties *
PS C:\> "CN=" + $DeletedUser.CN.Split("`n")[0] + "," + $DeletedUser.LastKnownParent
CN=John Doe,OU=Users,OU=My Business,DC=protectigate,DC=com
PS C:\>

7.5. Now return to the ldp window, this time type in DistinguishedName in the Attribute box.
Next, copy the distinguished name itself in the Values field. In our example it is: CN=John Doe,OU=Users,OU=My Business,DC=protectigate,DC=com
Under Operation select the Replace option.
Click Enter.

Restore AD Active Directory Object – Tombstone Reanimation

8. Make sure the Extended box is checked and click on Run.

Restore AD Active Directory Object – Tombstone Reanimation

At this point the account should reappear in the original LDAP location, in this example it's the My Business / Users onganizational unit.

If the account is not restored, check the ldp window for errors. You likely made a typo or made the wrong selection somewhere. For example I forgot to set the Operation option to Replace at step 7.5 and got the following error message:
Restore AD Active Directory Object – Tombstone Reanimation

9. Open dsa.msc and locate the user account. It shows up as disabled, this is it's password was removed during the deletion process, along with some other properties, like UPN and name that we need to manually replace now.

Restore AD Active Directory Object – Tombstone Reanimation

10. Double-click on the user account. Under the General tab fill out the name fields, then switch to the Account tab and set the User logon name to the appropriate value. Our John Doe had the UPN as john.doe@protectigate.com

Restore AD Active Directory Object – Tombstone Reanimation

11. The last thing we need to do is reset the password and enable the account.
Right-click on the account, select Reset Password, then type in the desired value in both the New password and Confirm password fields. Hit OK.
Then right-click on the user one more time and select Enable Account.

Should you have any question or comments please let me know below!

Reader Interactions

Comments Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Tools

Secondary Sidebar

CONTENTS

  • Oops, the account is deleted!
  • Restore the deleted AD User account

  • Terms of Use
  • Disclaimer
  • Privacy Policy
Manage your privacy

To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.

Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.

Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Statistics

Marketing

Features
Always active

Always active
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
Manage options
{title} {title} {title}
Manage your privacy
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Statistics

Marketing

Features
Always active

Always active
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
Manage options
{title} {title} {title}