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:

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 193 Articles
I work as a System Engineer, based in Switzerland with a primary focus on Microsoft technologies. I have 7 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 "MCSA: Windows Server 2012" and "Administering & Deploying SCCM" certified.