Monday, February 1, 2021

Recover an object from Active Directory Recycle Bin

To recover an object or user account that was deleted from Active Directory (if the AD Recycle Bin has been enabled), use the command below to view the contents of the items that have been deleted.

Get-ADObject -filter 'isDeleted -eq $true -and name -ne "Deleted Objects"' -includeDeletedObjects

Found the object in question and make note of the GUID parameter.

Deleted           : True
DistinguishedName : CN=Test Account\0ADEL:a769525b-0ac1-40c6-9cb5-9cdd8d221435
                    ,CN=Deleted Objects,DC=test,DC=local
Name              : Test Account
                    DEL:a769525b-0ac1-40c6-9cb5-9cdd8d221435
ObjectClass       : user
ObjectGUID        : a769525b-0ac1-40c6-9cb5-9cdd8d221435

Use the command below with the GUID value.

Restore-ADObject -Identity 'a769525b-0ac1-40c6-9cb5-9cdd8d221435'

https://stealthbits.com/blog/active-directory-object-recovery-recycle-bin/

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.