Knowledge Base
Home / Backup / Excluding Files from Shadow Copies
Use the FilesNotToSnapshot Registry Key to exclude files from Shadow Copies.
A VSS application can delete files from a shadow copy during shadow copy creation by using the following registry key:
HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Control \ BackupRestore \ FilesNotToSnapshot
This registry key has REG_MULTI_SZ values for each application whose files can be excluded. The files are specified by fully qualified paths, which can contain the * wildcard.
In all cases, the entry is ignored if there are no files that match the path string.
After a file is added to the appropriate registry key value, it is deleted from the shadow copy during creation by the shadow copy optimization writer on a best-effort basis.
If a fully qualified path cannot be specified, then a path can also be implied by using the $UserProfile$ or $AllVolumes$ variable. For example:
To make the path recursive, append " /s" to the end. For example:
The $UserProfile$ variable causes the path string to be applied to all user profiles on the computer. The user profiles are enumerated by examining the following registry key:
HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows NT \ CurrentVersion \ ProfileList
The $AllVolumes$ variable causes the path string to be applied to all shadow copies on the computer. For example, suppose the path is "$AllVolumes$\TemporaryFiles\*.* /s", and the computer has three volumes: C:, D:, and E:. If C: and E: contain the path "\TemporaryFiles\", and volume D: contains only the path D:\Data\, the directory tree C:\TemporaryFiles\ is deleted from shadow copies of C:, and the directory tree E:\TemporaryFiles\ is deleted from shadow copies of E:.
Administrators can disable expansion of the $UserProfile$ variable by using the following registry key:
HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Services \ Vss \ Settings
Under this registry key, specify DisableUserProfileExpansion for the value name, REG_DWORD for the value type, and a nonzero value for the value data.