Recovery AD User (Active Directory objects) using Active Directory Power Shell in Windows 2012 R2 or Windows 2016

If you delete the active directory user by mistake and AD recycle bin is enabled then you can use AD active directory administrative center to recover it easily.
Below is an example of the recovery process of a test user account.

Open Active Directory users and computer - Delete test user.


Open Power shell module for Active Directory from Admin tools.
Click – Run – Control and Press Enter to open Control Panel.
Double Click on Administrative tools – Double Click on Power Shell Module for Active Directory.



Type below command to get the deleted user

Get-ADObject -Filter 'samaccountname -eq "test123"' –IncludeDeletedObjects

You can use below command to get the deleted ad user with all properties and then restore it.

Get-ADObject -Filter 'samaccountname -eq "test123"' -IncludeDeletedObjects -Properties *





Run the below command and it will restore the user.

Get-ADObject -Filter 'samaccountname -eq "test123"' -IncludeDeletedObjects -Properties * | Restore-ADObject

Check in AD and make sure deleted user has restored.


Comments

Popular posts from this blog

The System could not log you on. The revocation status of the smart card certificate used for authentication could not be determined

Unblock gemalto .net smart cards using Gemalto response calculator

The System could not log you on. The revocation status of the smart card certificate used for authentication could not be determined