What is the proper way to clear the recycle bin for all users in Windows Server 2008 R2?
Windows Server 2008 R2 – Clear Recycle Bin for All Users
windowswindows-server-2008-r2
Related Topic
- Windows – Removing a file from a network share not in the recycle bin
- Windows – Recycle Bin on Server 2008 Redirected Folders no longer works
- Windows – Restore files from a recycle bin, that is located on a server store of a roaming profile
- Windows – “Virtual recycle bin” for DFS
- Windows – Recycle Bin for Network Share
- Hide Recycle Bin on Windows Server 2012 – How to Guide
- Implications of Enabling Recycle Bin Feature in Active Directory
- Windows – Open files inside Windows Recycle Bin
Best Answer
As far as I can tell, these is no "official" Microsoft supported way of doing this. There are two options. One involves deleting c:\$Recycle.Bin and the other is scripting cleanmgr.exe to run at each user logon.
The closest thing to "official" support for deleting c:\$Recycle.bin is from this MS KB, which references XP and Vista, but implies the expected behavior.
Immediate deletion
If you want this to happen immediately, it seems that you can just run
rd /s c:\$Recycle.Bin
and Windows should re-create the necessary folders the next time that they are needed. I just tested this quickly and it appears to work, but -obviously- proceed with caution.Recurring logon-scriptable deletion
You can do this with the Disk Cleanup tool (cleanmgr.exe). Unfortunately, Microsoft decided to bundle this with the "Desktop Experience" set of features, meaning you'll have to install a bunch of other crap and reboot.
The alternative is to grab the following two files and move them to the specified locations per Technet:
Cleanmgr.exe should go in %systemroot%\System32.
Cleanmgr.exe.mui should go in %systemroot%\System32\en-US.
Running cleanmgr alone won't let you clear everyone's recycle bin, but you can use /sageset and /sagerun to make a logon script that runs for all users via GPO that will clear their recycle bin on the next logon, as described here. It's not the cleanest thing, but it will work. The linked article is for XP, but the syntax is unchanged as of Server 2008 R2.