PoshTip #55 – How to Empty the Active Directory Recycling Bin?

From Windows Server 2008 R2, you can recover Active Directory deleted objects. Your forest functional level must be at least 2008 R2 in order to use this feature. Sometimes, It can be useful to permanently empty the contents of this recycling bin.

You can perform this task using Windows PowerShell. Simply use the Get-ADObject cmdlet and pipe the result to the Remove-ADObject cmdlet:

Get-ADObject -Filter 'isDeleted -eq $true -and Name -like "*USERNAME*"' -IncludeDeletedObjects | Remove-ADObject

Don’t forget the -IncludeDeletedObjects parameter. You also can add -Confirm:$false if you don’t want to confirm each deletion individually.


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.