Sunday, January 21, 2024

Exclude paths from Windows 7 backup

 https://kb.synology.com/en-id/C2/tutorial/How_do_I_exclude_files_and_folders_from_backups
 https://learn.microsoft.com/en-us/windows/win32/vss/excluding-files-from-shadow-copies

To exclude files / folders / paths from Windows 7 backup:

1) In Regedit.exe, navigate to the following regkey.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\BackupRestore\FilesNotToSnapshot
2) Create a new MULTI_SZ regval called anything descriptive, or such as, "Excluded-20240121".
3) Double-click the new regval to open it, and add the full file path of the file name, folder name, or wildcard you want excluded.
4) Add multiple paths to the regval, or repeat with additional regvals as necessary.

This regkey should already exist and contain default values for various commercial products, and you can see these as examples.  There are features to support subdirectories, wildcards, and also some stock variables.

Exclude all files in C:\temp, but not subfolders:
  C:\temp\*.*

Exclude all WSUS downloaded files with subfolders:
  %windir%\softwaredistribution\*.* /s

Exclude all Firefox browser cached files stored in all user profiles:
  $UserProfiles$\AppData\Local\Mozilla\Firefox\Profiles\tofolsma.default-esr\cache2\*.*

Exclude all enumerated NTLite temp folders and their subfolders
  C:\NTLite.tmp\Temp\NLTmp* /s

Exclude Temp folder from each drive with subfolders
 $AllVolumes$\Temp\*.* /s

Exclude all Windows upgrade files left behind on all volumes:
  $AllVolumes$\$WINDOWS.~BT\*.* /s


Saturday, January 13, 2024

Enable Recycle Bin on all drives (normally not on USB flash)

Source: 
  https://www.elevenforum.com/t/enable-recycle-bin-for-removable-drives-in-windows-11.5106/
  https://winaero.com/how-to-enable-the-recycle-bin-on-removable-drives/

When Windows 10 deletes files on a USB flash drive, you are prompted to "permanently delete" them, meaning no Recycle Bin if it's an accidental deletion. The following registry entries will allow Recycle Bin to activate on flash drives.  This affects in real-time, though you may need to switch explorer pane to a new drive and back, or eject and reinsert the flash drive.

Only the HKLM setting is needed for everyone.
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v RecycleBinDrives /t REG_DWORD /d 0xffffffff /f

... or the following for one user.
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v RecycleBinDrives /t REG_DWORD /d 0xffffffff /f

Delete these entries from the registry to restore default behavior.
reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v RecycleBinDrives /f
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v RecycleBinDrives /f

Note: If you are moving the flash drive between machines, you must implement this behavior on each new machine.  If you're not using Group Policies, it may be smart to add a CMD file to affect the HKCU setting on each flash drive you need to maintain a Recycle Bin.