Powershell – Restore AD object from recycle bin
By: Date: August 7, 2021 Categories: Powershell Tags: , , , , , , ,

If you have the recycle bin in AD enabled you can restore deleted items.

To get all the items in recycle bin:

Get-ADObject -ldapFilter:"(msDS-LastKnownRDN=*)" -IncludeDeletedObjects

To get one item (change the username):

Get-ADObject -Filter {displayName -eq "username"} -IncludeDeletedObject

To restore one item (change the username):

Get-ADObject -Filter {displayName -eq "username"} -IncludeDeletedObjects | Restore-ADObject

Leave a Reply

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