Purge the Active Directory Recycling Bin using PowerShell

One of the coolest Active Directory features is the recycle bin which gives you the ability to recover deleted Active Directory objects. Your forest functional level must be at least 2008 R2. When you delete an object, you can restore it through the Active Directory Administrative Center.

Sometimes, you may want to permanently delete one item in this recycling bin. There is no way to perform this task using the GUI, so you must use Windows PowerShell.

First, check if the deleted object is still in the recycle bin:

PS > Get-ADObject -Filter 'isDeleted -eq $True -and Name -like "*username*"' -IncludeDeletedObjects

Depending the output, you can permanently remove the object using the following:

PS > Get-ADObject -Filter 'isDeleted -eq $True -and Name -like "*username*"' -IncludeDeletedObjects | Remove-ADObject

You can add -Confirm:$false if you don’t want to confirm the deletion.

Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.