Hi, Gary here, and I have been seeing a few more questions regarding the recycle bin on redirected folders. With the advent of Windows Vista there was a change in redirected folders and the support for the Recycle bin. Now each redirected folder has a Recycle Bin associated with it. Windows XP only implemented it for the My Documents folder. Unfortunately, the Administrative Templates only give control of the bin as a whole and not for each redirected folder. The global settings can be controlled by the following policies that work with at least Windows XP:
User Configuration\Administrative Templates\Windows Components\Windows Explorer
Display confirmation dialog when deleting files
Do not move deleted files to the recycle bin
Maximum allowed Recycle bin size
Since there are no policies for the individual bins, we have to modify the registry settings for the user in other ways.
Before you start: modifying these registry keys is officially unsupported. They may stop working at any time after a service pack, hotfix, etc. comes out someday.
That would be through the use of Group Policy Preferences Registry settings or script that would import or set the registry settings. No matter which way you would do it, the registry would have the following settings for each known folder recycle bin:
MaxCapacity (REG_DWORD) in MB with a minimum value of 1
NukeOnDelete (REG_DWORD) 0 (move to recycle bin) or 1 (delete)
Note: Known Folder GUIDs can be found at here.
Example registry path for the redirected My Documents/Documents folder would be:
What is the easy way to get the registry settings and push them out?
The easy way to get the registry settings would be by redirecting the desired folders and configuring the Recycle bin for each folder as desired through the GUI with a user that is already redirected. That is by right-clicking on the Recycle Bin icon and bringing up Properties to configure the individual recycle bin settings of a user that has the folders already redirected. The following picture is an example where just the Documents folder was redirected and configured to delete the files immediately. As other folders are redirected there will be other entries that show up there for each of the additional locations.
Once you have the registry settings, you have the following options to push out the desired settings to the client machines:
Export the KnownFolder key and then import with a logon script or other method to import the values
- Open Regedit.exe by clicking the Start button and typing it in the Search section.
- Navigate to the following registry location:
- Right-click on the KnownFolders key and choose export to save it to a file such as recyclebin.reg
- Use the following example command line to import the recyclbin.reg file in a logon script or GPO script:
regedit /s recyclebin.reg
Create a Group Policy Registry preference setting to push out the NukeOnDelete and MaxCapacity settings for each folder to control. The advantage of this is that if you desire you can modify the settings and get pushed out and use the built in filtering to control specific settings application or value.
- With GPMC installed on the machine edit or create a new policy in the domain
- Navigate within the editor to the following location
User Configuration\Preferences\Windows Settings\Registry
- Right-click and choose New->Registry Item
- Click on the “…” button next to the Key Path edit box
- Navigate to the KnownFolder key path described in this blog and the GUID of the redirected folder.
- Select the MaxCapacity value and click OK
- On the Common tab, check the box for “Run in logged-on user’s security context (user policy option)
- Click OK
- Repeat steps 3-8 for the NukeOnDelete value
- Repeat steps 3-9 for each additional GUID you want to control
What happens to files already in the recycle bin when the setting is applied to the registry?
The NukeOnDelete value just tells Explorer that no additional files will be put in the recycle bin and will be deleted from the file system. Files and folders that are already in that bin will remain until it is emptied and the MaxCapacity essentially gets ignored at that time. It might be best to configure the MaxCapacity to 1 MB and NukeOnDelete to 0 to start out with. That way the maximum size the recycle bin would be is 1 MB and the next time the user deletes a file it will be reduced to that size as well. Then the NukeOnDelete could be changed to 1 later on and the recycle bin won’t be taking up any additional space.
Can we just delete the $RECYCLE.BIN folder from the network location?
That would be one way to “empty” the specific recycle bin on the user’s behalf. However, no matter what the settings are, the next time a file is deleted it will get recreated so don’t expect it to remain deleted for very long. Also, from then on the recycle bin will honor the setting anyway.
Can the deleted files move the local recycle bin instead of staying on the network location?
No. The Recycle Bin folder view is a merged view of all the locations into one view. When a file or folder is deleted, it is just moved and renamed on the same drive. No copying is involved.
While we do not have a way to control the individual recycle bin folders through policy in box we can do it through the registry to get that out to multiple machines now for management.
Gary “Waste Management Consultant” Mudgett