Thursday, November 5, 2015

Restore Deleted Objects From AD Using Recycle Bin Feature

Enable Recycle Bin Feature:

Recycle bin feature available in Windows Server 2008 R2 and later versions. Make sure this feature is enabled before restoring any deleted object in AD.

To Check open Powershell window and type below commands:

PS C:\Import-Module ActiveDirectory

PS C:\Get-ADOptionalFeature -filter


EnabledScopes blank {} shows that the Recycle bin feature is not enabled.

To enable the feature, run the below command:

PS C:\Enable-OptionalFeature 'Recycle Bin Feature' -Scope ForestOrConfigurationSet  -Target domain.com


Restore deleted objects:

To restore the deleted object we must know the GUID of the deleted object. To get the GUID of the deleted object run the below command:

PS C:\Get-ADObject -filter 'isdeleted -eq $true -and name -ne "Deleted Objects" ' -includeDeltedObjects -property * >c.txt 


Now find out the ObjectGUID from the text file and copy it. 


Run below commands with the GUID to restore the object(s).

PS C:\Restore-ADObect 4454bffb-118f-4f12-972e-60f722ee6462


The deleted object will be restored with all the permissions and group membership.