What should I do if my AD account is accidentally deleted? These graphic methods will help you run away without carrying a bucket!

Table of contents

Preface

1. Powershell command mode recovery

Before deletion

After deletion

recover

2. Active Directory Management Center Recovery

Before deletion

After deletion

 recover

 3. Summary


Preface

Whether you are an IT administrator, system operation and maintenance, etc., you must be familiar with AD.

You may be familiar with AD user creation and deletion operations, but you may be unfamiliar  with how to recover a deleted AD account .

Here we give you two more convenient ways to solve the problem of accidental deletion recovery:

  1. Comes with command: Powershell command mode recovery
  2. Management Tools: Active Directory Administrative Center Recovery

  1. Here I use the domain account test, whose name is test

  2. For actual use, please make changes according to the actual environment.

1. Powershell command mode recovery

  • Before deletion

Get-ADObject -Filter {samaccountname -eq "test"} -IncludeDeletedObjects

Before deleting, use the above command to check the account status, as shown below:

Not deleted: If the test AD account has not been deleted, the value after Deleted is: null


  • After deletion

If the testAD account has been deleted, execute the above command and return to the following figure:

Get-ADObject -Filter {samaccountname -eq "test"} -IncludeDeletedObjects

After deletion: If the test AD account has been deleted, the value after Deleted is: True


  • recover

Get-ADObject -Filter {SamAccountName -eq “test”} -IncludeDeletedObjects |Restore-ADObject

Execute the following command to restore the deleted account "test"

 At this time, the "test" account that was accidentally deleted will be restored to its original OU location, and the user attributes before deletion will be retained.


2. Active Directory Management Center Recovery

Earlier we used the Powershell command method, which is not very friendly to students who are not familiar with commands. So this method teaches you to use the interface method to restore;

  • Before deletion

  • After deletion

  •  recover

Open Active Directory Administrative Center

Right-click the Windows PowerShell icon, click Run as administrator, and then type DSAC.EXE to open the Active Directory Administrative Center

 Select--Left--Local (domain name)

 Middle--Find the "Deleted Objects" container

If not, go to the upper right corner--pipeline--add navigation node--add "Deleted Objects" container

 If it cannot be found, go to the right column--domain name (local)--enable the recycle bin

 Double-click to open the "Deleted Objects" container

 See the deleted account--restore it

 3. Summary

       Of course, in addition to these methods shared by bloggers, there are of course other methods, even primary and secondary services, etc. In short, everyone can use them flexibly according to the situation.

       If you have any questions, you can discuss it in the comment area or private message. There are always more methods than difficulties.

       If you have any other useful methods, please comment, share and discuss.

Please like, comment, follow, forward, and support. The blogger will actively update and work together! ! !

Guess you like

Origin blog.csdn.net/qq_42465243/article/details/131330771