Clear All Users Recycling Bins

Your Answer

Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Video

How to Empty Recycle Bin using Disk Cleanup

Windows. old folder contains a copy of the previous Windows installation in C: disk, and it takes up much of storage. It can free up several GBs of disk space by using the Remove previous Windows installations option in Disk Cleanup Tool.

Step 1: Open the Disk Cleanup tool in the Run.

Press Win+R keys to open Run dialog, type cleanmgr, and then hit Enter key.

Wait while the system is calculating the amount of

Wait while the system is calculating the amount of the used space.

Step 2: Once the tool opens, click Clean up system file button.

Step 3: Scroll down till you see Recycle Bin. Chec

Step 3: Scroll down till you see Recycle Bin. Check this option and click on OK.

Step 4: Click on Delete Files to complete the task

Step 4: Click on Delete Files to complete the task.

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.

Update1

With all above mentioned settings enabled, I tried to delete the $Recycle.Bin folders with Explorer, result: they reappear after pressing F5

Used rd X:\$Recycle.Bin /s /q and they didn’t recur after multiple F5 presses so far, I don’t know why though, I thought it would have the same effect as deleting it in explorer.exe…

But what does Don't move file to the Recycle Bin. Remove files immediately when deleted. do? What registry key and value does it write? Can anyone tell me?

The $Recycle.Bin folders have reappeared… I have confirmed, clicking on "Recycle Bin" folder will recreate the $Recycle.Bin folders…

I used procmon and got this:

It seems that Don't move... sets nukeondelete to enabled on current drive.

I have written a PowerShell script to automatically disable Recycle Bin on all drives, using Get-Volume and Set-ItemProperty;

This is the script I mentioned, I post it here in case anyone else might want to do it:

I am now looking for ways to prevent creation of $Recycle.Bin, I am thinking about group policy and security options.

I have found this:**GPO – How to block creation of folder and files in root directory in Windows 10

Don’t know if it will work though(I am only trying to block recycle bin), and how to do it with security options?

PowerShell Empty Recycle Bin

If you want to empty recycle bin on local computer, use below command

Above command in PowerShell to empty all recycle bin on local computer ask for user confirmation to delete contents of recycle bin as below

Upon Yes or yes to All consent, it will empty all recycle bin on local computer.

Cool Tip: How to convert decimal to hex in PowerShell!

Examples

1: Clear all recycle bins

In this example, all the local computer’s recycle bins are cleared.

Clear-RecycleBin prompts the user for confirmation to clear all recycle bins on the local computer.

2: Clear a specified recycle bin

This example clears the recycle bin for a specified drive letter.

Clear-RecycleBin uses the DriveLetter parameter to specify the recycle bin on the C volume. The user is prompted for confirmation to run the command.

3: Clear all recycle bins without confirmation

This example doesn’t prompt for confirmation to clear the local computer’s recycle bins.

Clear-RecycleBin uses the Force parameter and doesn’t prompt the user for confirmation to clear all recycle bins on the local computer.

An alternative is to replace -Force with -Confirm:$false.

Advertisement

Tags

Tags

Leave a Reply

Your email address will not be published.

Adblock
detector
Go up