Asked by:
Enable Recycle Bin on mapped network drives

General discussion
-
A few years ago I discovered how redirected user profile folders in Windows get Recycle Bin protection, even when the folders are redirected to a network location. This was a huge find for me, and I used this feature to add Recycle Bin coverage to some of my mapped network drives. I shared this information on another forum here:
http://forums.mydigitallife.info/threads/16974-Tip-Network-Recycle-bin
Today I figured out a better way to achieve the same goal that doesn't rely on user profile folder redirection, and am sharing that information for other users to try out. You might want to take a look at these forum topics for additional information:
- http://technet.microsoft.com/en-us/library/cc787939(v=ws.10).aspx
- http://blogs.technet.com/b/askds/archive/2012/07/16/managing-the-recycle-bin-with-redirected-folders-with-vista-or-windows-7.aspx
- http://msdn.microsoft.com/en-us/library/bb882665.aspx
- http://social.technet.microsoft.com/Forums/windowsserver/en-US/10bfcfb9-14f3-434e-9ffa-0289b8b32e01/folder-redirection-recycle-bin
The standard disclaimer applies - this might break stuff. I've only tested in Windows 8, and my testing is limited. Try this at your own risk.
This is what I've learned (or think I've learned - I might be wrong):
- Windows Vista and later store the configuration settings for the Recycle Bin for redirected user profile folders in this registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder
- Under this key are separate keys for each redirected folder that is protected by the Recycle Bin. The keys contain the configuration information for each protected folder, and are named to match the GUIDs for "Known Folders." A list of the Known Folder to GUID mappings is available in one of the links above.
- The registry also contains a list of "known folders" at this location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions
So, I reasoned that if I could create my own custom "known folder," I could add that to the list of folders that were protected by the Recycle Bin and protect any mapped network drive I wanted. So I looked at the list of existing "known folders" and created a key that was similar to the Documents key. I then fiddled with the values in the key until I narrowed it down to the minimum number needed to make the recycle bin work.
This .reg file will protect a mapped X: drive with a ~50GB recycle bin. You should modify the file to fit your needs:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{9147E464-33A6-48E2-A3C9-361EFD417DEF}] "RelativePath"="X:\\" "Category"=dword:00000004 "Name"="XDrive" [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{9147E464-33A6-48E2-A3C9-361EFD417DEF}] "MaxCapacity"=dword:0000c7eb "NukeOnDelete"=dword:00000000
A few things of note:
- The GUID in the above .reg file {9147E464-33A6-48E2-A3C9-361EFD417DEF} came from this PowerShell command: "{"+[guid]::NewGUID().ToString().ToUpper()+"}"
- Each "known folder"/Recycle Bin combination requires a unique GUID. If you don't want to use PowerShell to generate a GUID, you can use an online GUID generator.
- I don't know what the "Category" value does, but the key I copied had it set to 4, and that works, so I didn't test any other values.
- The "Name" value is required, but is not the name that will be shown if you right-click on the Recycle Bin and select properties. (At least not in my environment.) In my environment, the name that is shown is the name of the network drive.
- Making this change adds a "Location" tab to the properties page of your mapped network drives. I suspect this could be removed by changing the "Category" value, but didn't bother to find out.
- I only tested with mapped network drives. I suspect this would work with UNC paths as well, but I didn't bother testing.
I hope you're as excited to find this as I was to figure it out. Let me know if this works for you. I now plan to deploy the registry keys with Group Policy Preferences and will update this forum post with any information I discover.
Best regards
--Russel
Update: I am now using Group Policy Preferences to deploy the needed registry keys, and all my mapped network drives are now protected by the recycle bin.
Update 2: I have tested now with UNC paths, and this works fine. I still use mapped network drives, but if your environment requires UNC paths instead, you can use them. Note however that if you have a mapped network drive that points to a UNC path, and you protect the UNC path with a registry change, if a user deletes a file from the mapped network drive that points to that UNC path, the file will be permanently deleted. See below for more details.
- Edited by Russel Riley Friday, September 26, 2014 1:13 PM
Thursday, October 3, 2013 6:27 AM
All replies
-
Wednesday, October 9, 2013 3:11 AM
-
Hello there,
I was playing around with this and after it moves the files in the folder to the network share it deletes the folder from the users PC. How do I go about undoing this change? I attempted to remove the registry entries but that did not work.
Thank you
Thursday, February 13, 2014 8:16 PM -
Hi Nnyan,
I'm not sure what you've done in your environment, but from the context of your post, it sounds like you've redirected a user profile folder to a network share. When you move a user profile folder (like c:\<username>\documents) to another location, Windows prompts you if you would like to move the files. If you click yes, it moves them to the new location. To move the files back, just move the files back. If you want them to be available in both locations, just move them to the network location and make them available offline.
HTH
-Russel
Saturday, February 15, 2014 7:03 PM -
Hello,
Thanks for sharing this.
But under Win7 it does not work.
Although your previous trick (http://forums.mydigitallife.info/threads/16974-Tip-Network-Recycle-bin) works better, but with the only limitation that once you move the folder to another location (ex savedGame moves from M:\ to N:\) the original mounted drive (M:\) is not longer protected with the recycled bin.
I played with the Shell Folder entry in the registry but this had no influence.
Laurent
Sunday, April 13, 2014 11:00 PM -
I just built a Windows 7 VM and tested it. Everything worked fine. I'm using Group Policy Preferences from my domain to push the registry settings to my clients, so I know the settings are exactly the same a what my Windows 8.1 clients have.
--Russel
Monday, April 14, 2014 1:02 PM -
Bravo to you for uncovering functionality that actually works. I love this kind of stuff.
I don't have time to experiment with it yet, but I will. For now, some questions...
Did you get it to work with UNC paths? How do the registry entries (e.g., RelativePath) have to differ in order to accomplish that?
Also, when you do Properties on the Recycle Bin namespace (in the Navigation - left - pane of Explorer), do your "new" recycle bins show up there? And once established can that dialog be used to change the max size?
Might the Category entry set the "Optimize this folder for" setting to "General items", which will affect how Explorer displays it? That's just a guess.
Good job figuring this stuff out!
-Noel
Detailed how-to in my eBooks:
Configure The Windows 7 "To Work" Options
Configure The Windows 8 "To Work" OptionsMonday, April 14, 2014 1:28 PM -
I restart of the PC was needed ! Now it works fine.Tuesday, April 15, 2014 12:56 PM
-
Hi Noel,
Thanks for the compliment. It works fine with UNC paths. Just change the RelativePath from X:\ to \\fileserver\share. (If you use a .reg file as in the example above, you'll have to escape the back slashes, so probably \\\\fileserver\\share would be correct.)
One caveat when using UNC paths vs drive letters: Suppose your users have z:\ mapped to \\fileserver\share, and you have the UNC path protected with the recycle bin. If a user deletes a file from the mapped drive, it will be permanently deleted. I haven't experimented with using 2 registry settings for the same location - one with a mapped drive letter and one with a UNC path, but I suspect it would work just fine.
When I display the Recycle Bin properties, I get a regular window listing my network locations (X: and Y:) along with all the redirected profile folders. It works just like normal. But in my case, since my settings are defined by Group Policy Preferences, any changes I make here get overwritten by Group Policy.
As for the "Catergory" entry, I never bothered to find out. Once I got it working, I just called it good.
Best regards,
-Russel
Wednesday, April 16, 2014 5:18 AM -
This is what I do as a domain policy.
On the DC I already have various logon batch files set up in the User Configuration\policies\Windows settings\Scripts which typically have things like
net use r: \\hv1\company_docs
Rather than scattering new policies around, I've simply added to this batch file, for this drive:
rem add company_docs to local recycle bin
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{BB6CC368-07C4-4EF1-B600-6BBF588505A6} /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{BB6CC368-07C4-4EF1-B600-6BBF588505A6} /v RelativePath /t REG_SZ /d R:\ /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{BB6CC368-07C4-4EF1-B600-6BBF588505A6} /v Category /t REG_DWORD /d 00000004 /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{BB6CC368-07C4-4EF1-B600-6BBF588505A6} /v Name /t REG_SZ /d RDrive /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{BB6CC368-07C4-4EF1-B600-6BBF588505A6} /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{BB6CC368-07C4-4EF1-B600-6BBF588505A6} /v MaxCapacity /t REG_DWORD /d 0000c7eb /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{BB6CC368-07C4-4EF1-B600-6BBF588505A6} /v NukeOnDelete /t REG_DWORD /d 00000000 /fThis seems to work perfectly (on Win 7 clients), so thankyou for a brilliant solution.
One minor thing: Since I haven't created an equivalent logoff script to remove these registry entries, what I don't know is what happens on logins after the first one. There doesn't seem to be any unexpected effects, I suppose reg add just fails silently if the keys already exist.
Richard
- Edited by richardmh Thursday, May 29, 2014 10:27 AM
Thursday, May 29, 2014 9:27 AM -
Hi there,
i justed tried to do the trick but i get an Access denied error when i delete something on the Network drive.
What can i do? Someone else had this issue?
MartinThursday, September 25, 2014 4:34 AM -
I haven't had the issue you're describing. How are your share permissions and NTFS permissions? On my shares, I enable Change and Read for Everyone. At the NTFS level, I grant Modify permissions to the security group that controls access to the share. Also, what is hosting your shares? I've only tried this with a Windows machine hosting my shares - never on a NAS or other storage device.
--Russel
Friday, September 26, 2014 1:09 PM -
Great find.
What about non-Windows clients hitting a Windows Server share via Samba, i.e. Macs? We're getting more and more Mac users and after another Mac user just deleted an entire directory that we had to restore I need to see about getting this to work with all clients.
thanks!
Tuesday, October 14, 2014 3:59 PM -
The actual recycle bin is a function of the clients. I don't know of any way to make a Linux or Mac client support a network recycle bin.Wednesday, October 15, 2014 6:59 AM
-
The script works great with clients on windows 7, iuse it on a production environment with Samba4.
The problem its, XP dont do nothing with the script, this not works on xp clients i think.
Any suggestions?.
Another problem its the users pemissions, users need permission for write the registry of local machine.
For Linux search for samba vfs-objects recycle, it can help you.
Sorry for my language, im speak spanish.
Tuesday, November 18, 2014 3:07 PM -
Hi Patocius,
I don't know of any answer for Windows XP clients. I don't think it will work because I don't think XP supports it. I think only Vista and later do.
--Russel
Wednesday, November 19, 2014 1:43 PM -
Hi there,
i justed tried to do the trick but i get an Access denied error when i delete something on the Network drive.
What can i do? Someone else had this issue?
MartinReinitializing the offline file cache might solve this issue:
http://support.microsoft.com/kb/230738Even though the article was written for XP, the registry entry works in Windows 7:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache
Key Name: FormatDatabase
Key Type: DWORD
Key Value: 1
Thursday, December 18, 2014 4:49 PM -
Russel –
Great article, we’ve loved the Recycle Bin feature with our redirected folders but always wondered if we could protect any network file and this article shows some interesting ideas.
What isn’t clear to us is how the MaxCapacity setting works. Does this pre-allocate/set aside that much storage on the network drive for the Recycle Bin? Or does it just say that the Recycle Bin can hold up to that amount (without carving out and holding that space – basically reducing the amount of storage available on the network drive)?
Also, what we found in our environment is that if we have 100 users that have the same network mapped drive (same UNC and drive letter) and pushing out the registry settings in HKLM & HKCU to enable Recycle Bin functionality for this network drive, that it creates a “shared” network Recycle Bin across all users. The net effect being each individual’s Recycle Bin contains their own deleted files from their redirected folders along with _everyone’s_ deleted files from the common network drive. It didn’t seem to matter if all users had the same “made up” GUID or if they each had their own GUID pair, in both cases, If a user deletes a file from the network drive (from anywhere but a redirected folder) that file will show up in that user’s “conglomerated view” in their Recycle Bin, and that files will show up in the Recycle Bin for all of the other users. It makes for a very full and busy Recycle Bin for everyone (not to mention many users asking why files they didn’t delete are in their Recycle Bin). Did you run across this in your environment?
Thursday, December 18, 2014 5:06 PM -
Russel –
Great article, we’ve loved the Recycle Bin feature with our redirected folders but always wondered if we could protect any network file and this article shows some interesting ideas.
What isn’t clear to us is how the MaxCapacity setting works. Does this pre-allocate/set aside that much storage on the network drive for the Recycle Bin? Or does it just say that the Recycle Bin can hold up to that amount (without carving out and holding that space – basically reducing the amount of storage available on the network drive)?
Also, what we found in our environment is that if we have 100 users that have the same network mapped drive (same UNC and drive letter) and pushing out the registry settings in HKLM & HKCU to enable Recycle Bin functionality for this network drive, that it creates a “shared” network Recycle Bin across all users. The net effect being each individual’s Recycle Bin contains their own deleted files from their redirected folders along with _everyone’s_ deleted files from the common network drive. It didn’t seem to matter if all users had the same “made up” GUID or if they each had their own GUID pair, in both cases, If a user deletes a file from the network drive (from anywhere but a redirected folder) that file will show up in that user’s “conglomerated view” in their Recycle Bin, and that files will show up in the Recycle Bin for all of the other users. It makes for a very full and busy Recycle Bin for everyone (not to mention many users asking why files they didn’t delete are in their Recycle Bin). Did you run across this in your environment?
Hi,
I don't think the MaxCapacity setting pre-allocates any storage. It just lets the recycle bin grow to that size before automatically deleting files, but I haven't tested this.
As far as the "shared" recycle bin goes, I have the same issue, but at a much smaller scale. I haven't implemented this in a production environment - just my home, so I only see files deleted by members of my family. I think the best you could do would be to create one recycle bin per share and have one share per department. Or you might be able to create a recycle bin for folders deeper down the file tree, but I'm not sure.
Consider this scenario:
- You setup a file server with \\server\share
- You create the registry keys to protect \\server\share
- You create a folder in \\server\share\department\otherFolder
- You create a separate registry key to protect the \\server\share\department\otherFolder path
In this scenario, I don't know what would happen. When a file from \\server\share\department\otherFolder get deleted, it might get moved to the recycle bin all the way up at the share, or all the way down in the otherFolder. I also don't know what kind of permissions would be required to clean out the recycle bin, or whose machine winds up doing the cleaning.
I suspect you could find some combination of settings that would create a unique recycle bin for each share, but I just haven't tried to find the answer.
--Russel
Friday, December 19, 2014 6:10 AM -
Thank you for your reply Russel, I didn’t mention this in the previous post, but we did try creating the Recycle Bins at the network user-folder path instead of the root. See the 2 examples below for the results.
Example 1: Network Recycle Bins
\\server\share\user\documents (from folder redirection)\\server\share (manually created)
- IIn this case (as mentioned in the previous post), everyone end’s up having a “shared” Recycle Bin, so everyone sees all of the files other people have deleted in their own “conglomerated” view when they look in their Recycle Bin. This leads to a very busy and full Recycle Bin and end users raising questions why files they didn’t delete show up in their Recycle Bin.
Example 2: Network Recycle Bins
\\server\share\user\documents (from folder redirection)
\\server\share\user (manually created)
- IIn this case, users do end up with their own “conglomerated” view in their Recycle Bin (i.e., no more seeing all the files other people have deleted), BUT there are 2 negatives to this configuration:
- Only files within the folder \\server\share\user are protected with Recycle Bin, so other “common” folders in the root of the share aren’t protected via Recycle Bin.
- And when files are deleted from \\server\share\user\documents, because they are protected twice by the Recycle Bin (once from folder redirection and once from the manually created Recycle Bin at the user-folder level), 2 copies of the deleted files appear in the “conglomerated” view of the Recycle Bin. This lead to users asking why they had duplicate files showing up for the majority of files they deleted. They often got confused thinking there were different versions of the files instead of duplicates.
- Edited by ColoradoState Tuesday, December 23, 2014 4:01 PM
Tuesday, December 23, 2014 4:01 PM -
I am also getting an access error, on computers not using offline files. What is the best way to undo the registry entries (too much time has passed to restore the registry) ?
Thanks.
- Edited by crewlaw Wednesday, February 18, 2015 3:49 AM
Wednesday, February 18, 2015 3:23 AM -
I am also getting an access error, on computers not using offline files. What is the best way to undo the registry entries (too much time has passed to restore the registry) ?
Thanks.
I don’t have any information about your access error. But removing the registry entries can be done by adding a ‘-‘ in front of the key name in a .reg file. Note that if you followed the steps above to create these registry settings, there are 2 parts, one that is applied to the Computer side (required Administrative credentials) and the other which is done on the User side (per user). Here are examples using the ‘-‘ sign in a registry file to remove/clean up the GUIS keys you created.
Computer / Administrative side:
Windows Registry Editor Version 5.00
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{<your GUID>}]
User side:
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{<your GUID>}]
Wednesday, February 18, 2015 3:52 PM -
FANTASTIC work Russel !
This is extremely helpful.I've turned your work into a Bat Script that will automatically make the reg file.
Just copy and paste the following into notepad
It creates a unique guid each time it is run, so no worries on overlaps.
and save it as "Network Recycling Bin - auto make registry file.bat"
echo off
REM ========== MAIN FUNCTION ========================
Call :CreateREGfile
PAUSE
goto :eof
REM ========== SUB FUNCTIONS ========================
:CreateREGfile
set /p RelativePath=Enter current mapped path of drive (e.g. X:\FileShare\D_Drive):
REM replace \ with \\ (for reg value its a requirement)
Set RelativePath=%RelativePath:\=\\%
set /p MaxBinSize_Dec=Enter max size (in mb) (eg 11gb=11000):
call :toHex %MaxBinSize_Dec% MaxBinSize_Hex
Set outputREG="Network Recycling Bin - %RelativePath:~0,1% Drive (%MaxBinSize_Dec%mb).reg"
call :MakeGUID_VBS NewGUID
REM echo My new GUID : %NewGUID%
echo Windows Registry Editor Version 5.00 > %outputREG%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\%NewGUID%] >> %outputREG%
echo "RelativePath"="%RelativePath%" >> %outputREG%
echo "Category"=dword:00000004 >> %outputREG%
echo "Name"="NetworkDrive2RecyclingBin_%NewGUID:~1,5%" >> %outputREG%
REM The "Name" value is required, but is not the name that will be shown if you right-click on the Recycle Bin and select properties. That will be autoset to the network drive name.
echo.>> %outputREG%
echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\%NewGUID%] >> %outputREG%
echo "MaxCapacity"=dword:%MaxBinSize_Hex% >> %outputREG%
echo "NukeOnDelete"=dword:00000000 >> %outputREG%
goto :eof
:MakeGUID_VBS
echo set obj = CreateObject("Scriptlet.TypeLib") > TEMP_generateGUID.vbs
echo WScript.Echo obj.GUID >> TEMP_generateGUID.vbs
FOR /F "usebackq tokens=*" %%rin (`CSCRIPT "TEMP_generateGUID.vbs"`)DO SET RESULT=%%r
set %1=%RESULT%
del TEMP_generateGUID.vbs
goto :eof
:toDec
:: todec hex dec -- convert a hexadecimal number to decimal
:: -- hex [in] - hexadecimal number to convert
:: -- dec [out,opt] - variable to store the converted decimal number in
SETLOCAL
set /a dec=0x%~1
( ENDLOCAL & REM RETURN VALUES
IF "%~2" NEQ "" (SET %~2=%dec%)ELSE ECHO.%dec%
)
EXIT /b
:toHex
:: eg call :toHex dec hex -- convert a decimal number to hexadecimal, i.e. -20 to FFFFFFEC or 26 to 0000001A
:: -- dec [in] - decimal number to convert
:: -- hex [out,opt] - variable to store the converted hexadecimal number in
::Thanks to 'dbenham' dostips forum users who inspired to improve this function
:$created 20091203 :$changed 20110330 :$categories Arithmetic,Encoding
:$source http://www.dostips.com
SETLOCAL ENABLEDELAYEDEXPANSION
set /a dec=%~1
set "hex="
set "map=0123456789ABCDEF"
for /L %%Nin (1,1,8)do (
set /a "d=dec&15,dec>>=4"
for %%Din (!d!)do set "hex=!map:~%%D,1!!hex!"
)
rem !!!! REMOVE LEADING ZEROS by activating the next line, e.g. will return 1A instead of 0000001A
rem for /f "tokens=* delims=0" %%A in ("%hex%") do set "hex=%%A"&if not defined hex set "hex=0"
( ENDLOCAL & REM RETURN VALUES
IF "%~2" NEQ "" (SET %~2=%hex%)ELSE ECHO.%hex%
)
EXIT /b
:eof- Edited by WillTurner Monday, April 6, 2015 9:43 AM formatting
Monday, April 6, 2015 9:31 AM -
Just wanted to say, "Great work!" Using this .reg on my Windows 7 machine at work and it's a big relief to have the Recycle Bin on my network drive since I like to do all my current work directly on it.Thursday, April 30, 2015 6:40 PM
-
First of all thank you for sharing your knowledge!
But ... I have exactly the same issue. When deleting a file Windows first asks whether I want to move it to the recycle bin, then it tells me in another dialog I need permission (granted by administrator) and shows a retry button. Then clicking retry fails as the file is already deleted. It does not matter whether Explorer runs as administrator anyways as the behavior is the same.
I assume that this is related to that the remote sharing the drive is on a Linux machine and not NTFS at all - as you were pointing out you never tried that - or did you actualy try that in the meantime?
Also the workaround provided by ColoradoState did not do the trick.
Wednesday, May 20, 2015 1:00 AM -
I'm pretty sure you've got an issue with the permissions on your file share. I don't run Linux file servers and probably won't ever, so I don't think I'll be able to find a solution. Keep in mind that you need write permission at the share level as well at the file system level.
--Russel
Saturday, May 23, 2015 4:41 PM -
Thanks for your reply.
That indeed sounds like a permission issue - but the permissions to write and delete are obviously there as I am able to create and delete files without any problem - but maybe I am missing something here. I have as well tried that with a shared NTFS host drive (though still mapped through VirtualBox on a Linux host) with the same result.
I have created a more broadly formulated question at Stack Exchange covering this issue some days ago - if you would like to follow check:
http://superuser.com/questions/917384/virtual-boxes-linux-hosts-windows-guests-shared-folders-and-recycle-bins
Saturday, May 23, 2015 5:29 PM -
Dear,
I give this error: %Nin was unexpected at this time.
Batch file is not worked on win 8 and 8.1
What is wrong?
Regards
Saturday, June 27, 2015 11:36 AM -
Russel,
I need your help for the same as explained to be set using group policy. I have windows 2003 server and clients on win7.
Please
Thursday, September 17, 2015 12:34 PM -
how to restore default after apply your tips?
i trial your tips. but after i change to default my explorer is not responding :s
Friday, October 9, 2015 6:40 AM -
Thank you for posting this. I am about to implement, but first wanted to research the category. Thinking it might literally be the KF_CATEGORY value. If so, the values per TechNet are:
KF_CATEGORY_VIRTUAL = 1,
KF_CATEGORY_FIXED = 2,
KF_CATEGORY_COMMON = 3,
KF_CATEGORY_PERUSER = 4The TechNet "KF_CATEGORY enumeration" page describes these, including that many features including redirection are not available for categories 1 and 2.
Tuesday, November 17, 2015 7:36 PM -
Awesome!!! THx for finding/creating this procedure.
Will be giving it a try.
also thx! everyone, who help with the other little tweaks!
I'v been looking for something like this.
There are paid solutions, but expensive. Unless someone knows of a cheap alternative.
Free is always best.
This feature should be automatically builtin to servers.
THX!!!! ALL!!!
Friday, December 4, 2015 9:52 PM -
SAMBA vfs might be a way to go for linux fileshares. It veers away from Russels approach but gives you the same recovery ability. Samba Recycle Bin.
http://timtrott.co.uk/enabling-recycle-bin-functionality-samba/
BTW, awesome find Russel. Will be applying it to a number of situations.
Sorry for the late post, almost a year later :)
Nick
Wednesday, March 16, 2016 1:32 PM -
Hi,
I have two mapped network drive. The (Z:) and (Y:). Network path is: \\192.168.0.1\Programs and \\192.168.0.1\Documents. I can just set one shared folder in registry. :S
Pls help, how can I set the second mapped network in recycle bin?
Thanks, David
- Edited by LiteCross91 Tuesday, April 19, 2016 9:43 AM
Tuesday, April 19, 2016 9:39 AM -
The exact same registry keys work for me on Windows 10. Have you tried rebooting? Also, if you want to protect multiple network locations, you need to write more than one registry key with different GUIDs. So from the example above where you need a key in HKLM and one in HKCU, you'd need a second key in HKLM and a second one in HKCU. You add multiple keys by replacing the GUID with one of your own.
--Russel
- Edited by Russel Riley Tuesday, April 19, 2016 1:00 PM
Tuesday, April 19, 2016 1:00 PM -
Oooo, I see. Thanks! I generated other GUID and it worked! Thank you!Wednesday, April 20, 2016 6:42 AM
-
FANTASTIC work Russel !
This is extremely helpful.I've turned your work into a Bat Script that will automatically make the reg file.
It creates a unique guid each time it is run, so no worries on overlaps.Just copy and paste the following into notepad
and save it as "Network Recycling Bin - auto make registry file.bat"
echo off
..
EXIT /b
:eof
- Edited by LiteCross91 Wednesday, April 20, 2016 6:44 AM
Wednesday, April 20, 2016 6:43 AM -
Hi Russel,
Great work! I have tested it on Windows 7, 8, 8.1,10 and it works fine!
It does not work if my mapped network drive uses a DFS path.
For example i have W:\ and the path is \\mydomain.local\share1.
If i go to w:\folder1 in the properties - DFS tab i see \\myservername\folder1. I tried to create regedit key with relative path \\myservername\folder1 but don't work.
Have you any idea?
Thanks
Fabio
Thursday, May 12, 2016 9:57 AM -
Hi Fabio,
I haven't tried using a DFS share, but if you're accessing the share using a mapped network drive, I'd guess you'll need a registry key where the RelativePath value is set to W:\, and not \\mydomain.local\share1. From what I've been able to gather, the recycle bin functionality is handled by Windows Explorer, and has nothing to do with the file server, but like I said, I haven't tried it on a DFS share.
-Russel
Friday, May 13, 2016 12:15 AM -
Such a brilliant solution. Thank You!
But, I've got two small a gripes with it.
- Security (which I should be able to test, but haven't come around doing). Lazy me asks if someone already got an answer.
On a common work area with this enabled. If a user deletes a file inside a restricted folder (we presume the file has inherited security from the folder it was created), it is moved to the $Recycle as intended. But can people who didn't have access before through the folder ACL now access the file trough the Recycle Bin?
- I had really big troubles getting it to work on a shared drive (UNC or Mapped). I rebooted, logoff and logged on. Couldn't get it to work "move this to the recycle bin", the file was only offered to be Delete. Until by pure trial and error took Task Manager and forced Explorer.exe to quit. Then restarted Explorer; and it started working! I suspect some cache thingy is to suspect here. Any one know how to solve this one? Can't force close the Explorer process if going company LAN with this one, to get it working :-)
My environment is for the moment humming along on:
Microsoft Windows 10 Pro
10.0.14393 Build 14393Monday, December 5, 2016 11:51 PM - Security (which I should be able to test, but haven't come around doing). Lazy me asks if someone already got an answer.
-
Thanks a lot Russel!
I'm on Windows 10 Pro 64 bit.
I have discovered that to have the trick to behave properly on a 64 bit Windows also when deleting files using a 32 bit program, we need to set also the corresponding Wow6432Node keys.
I was using an old file manager available only in the 32 bit version and deleting a file prompted for a permanent deletion while deleting from the Windows File manager prompted, as expected, for moving it to the recycle bin.
Building on your example:Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{9147E464-33A6-48E2-A3C9-361EFD417DEF}] "RelativePath"="X:\\" "Category"=dword:00000004 "Name"="XDrive" [HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{9147E464-33A6-48E2-A3C9-361EFD417DEF}] "MaxCapacity"=dword:0000c7eb "NukeOnDelete"=dword:00000000
HTH
Gianni
- Edited by Gianni1962 Sunday, March 19, 2017 8:50 PM more details
Sunday, March 19, 2017 8:42 PM -
Hello everybody,
thank you so much for this great tricks. I have just one small question: the procedure does not work for network drives without write access. Is there any workaround?
Best regards, Louis
- Edited by LouisLoop Thursday, September 26, 2019 2:30 PM
Thursday, September 26, 2019 2:28 PM