使用Network Recycle Bin启用映射网络驱动器上的回收站
前言
在內(nèi)網(wǎng)環(huán)境中我們經(jīng)常會使用NAS或者Samba在Windows中映射網(wǎng)絡(luò)驅(qū)動器,方便局域網(wǎng)用戶實(shí)時共享交換數(shù)據(jù)。但當(dāng)存儲在網(wǎng)絡(luò)或映射網(wǎng)絡(luò)上的任何文件被刪除時,該文件將被永久刪除。它不會去到本地計算機(jī)回收站,也不會去到服務(wù)器的回收站,我通過google在mydigitallife和microsoft technet中搜索到很多方法,但針對不同操作系統(tǒng)且涉及到域用戶管理的復(fù)雜情況下,單純的依賴注冊表修改可能已經(jīng)支撐不住需求的膨脹了。在所有的方法中使用Network Recycle Bin可以輕松解決映射網(wǎng)絡(luò)驅(qū)動器上的回收站。
使用Network Recycle Bin為局域網(wǎng)巧設(shè)“回收站”
更新歷史
2018年04月20日 - 初稿
閱讀原文 - https://wsgzao.github.io/post/network-recycle-bin/
擴(kuò)展閱讀
Network Recycle Bin Tool - http://www.networkrecyclebin.info/index.html
如何啟用映射網(wǎng)絡(luò)驅(qū)動器上的回收站
映射驅(qū)動器不過是將本地驅(qū)動器連接到另一臺計算機(jī)上特別分配的共享目錄或文件夾。 一旦驅(qū)動器被映射,您就可以訪問共享資源,您可以像對待您的系統(tǒng)本地一樣對待它??梢詫⒍鄠€計算機(jī)驅(qū)動器映射到共享資源,并利用此網(wǎng)絡(luò)空間。
當(dāng)存儲在網(wǎng)絡(luò)或映射網(wǎng)絡(luò)上的任何文件被刪除時,該文件將被永久刪除。 它不會去到本地計算機(jī)回收站,也不會去到服務(wù)器的回收站。 為了避免將來出現(xiàn)這種數(shù)據(jù)丟失情況,您可以在映射的網(wǎng)絡(luò)驅(qū)動器上啟用回收站。 按照以下給出的步驟在映射的網(wǎng)絡(luò)驅(qū)動器上啟用回收站.
注意:要驗(yàn)證此過程是否正常工作,請右鍵單擊回收站并轉(zhuǎn)至屬性,并檢查網(wǎng)絡(luò)驅(qū)動器是否在回收站的位置列中列出。
需要注意的事情
這僅適用于通過映射的網(wǎng)絡(luò)驅(qū)動器而不是UNC路徑訪問的文件。 我們舉一個例子:如果你已經(jīng)將\server\share映射到E:并從這個E:驅(qū)動器中刪除了一些東西,那么它將會進(jìn)入回收站。 但是,如果您瀏覽到\server\share并擦除文件,它將被永久刪除。
Enable Recycle Bin on mapped network drives
方案1,通過重定向文件位置的方式我自己在Windows 10下測試可用,但Windows 7失敗了
https://forums.mydigitallife.net/threads/tip-network-recycle-bin.16974/
You may have noticed that when you delete a file stored on a network location or mapped network drive that the file is permanently deleted. It does not go to the local computer's recycle bin and does not go to the server's recycle bin. I have discovered a work-around that extends recycle bin coverage to include mapped network drives. The solution is not 100% perfect, but works extremely well and does not rely on Shadow Copies or 3rd-party software.
Here's how:
方案2,通過修改注冊表搞定回收站問題,實(shí)際測試喜憂參半,通用性不高,不推薦
https://social.technet.microsoft.com/Forums/windows/en-US/a349801f-398f-4139-8e8b-b0a92f599e2b/enable-recycle-bin-on-mapped-network-drives
Just copy and paste the following into notepad 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 復(fù)制代碼Network Recycle Bin Tool簡介
本文主要使用Network Recycle Bin Tool Personal Client Machine Edition客戶端
Server Edition
version 6.1.1.3
This version has been designed for the server usage. You should install it on the server to monitor shared folders. When network user will delete a shared file it will copy it to the "network recycle bin". You have not install any additional software on client machines.
Personal Client Machine Edition
version 5.2.3.8
When you delete a file stored on a network location or mapped network drive that the file is permanently deleted. It does not go to the local computer's recycle bin and does not go to the server's recycle bin.
How to enable a recycle bin for shared folders on a network ? There is the proper solution of restoring and securing your information even after deleting it - The Network Recycle Bin Tool allows you to recover deleted files.
Once you have this tool in your system, it will automatically keep a track of all the network deleted files and you can easily recover them. Instead of removing the files, this tool sends them directly to its predefined recycle bin folder.
There are various options to tune it up. For example: you can set size limits for files stored in the Network Recycle Bin, you can define the list of network drives or network folders to track deleted files.
Additionaly it offers you the Protect Files tool which prevents deletion of network files for specified folders according the file mask. Export and import functions help you to install software with same options on network machines. The password control disallows unauthorized access.
In the long run, losing your important network files and information accidentally is not an issue these days. Instead of getting anxious and worried, feel free to download network recycle bin tool from any reliable source and make sure that you have pre-installed this recovery tool.
Network Recycle Bin Tool使用方法
使用方法非常簡單,安裝好Network Recycle Bin Tool只需要4步即可,其它需求可以自定義Options
總結(jié)
以上是生活随笔為你收集整理的使用Network Recycle Bin启用映射网络驱动器上的回收站的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: bondat蠕虫传播与对抗
- 下一篇: 软件工程—团队作业1