Microsoft VSS includes the ability to exclude file patterns from snapshots. Although this can be useful in removing unnecessary files from images and clones the functionality isn't 100% reliable. Removing files is reliant on the VSS Optimization Writer and the if the files are not removed before the VSS timeout time has elapsed then snapshots may not exclude all the desired files. However, In general, unless you are removing many thousands of files then there shouldn't be a problem.
If necessary, create the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToSnapshotMacriumImage
This key should already be present if a Macrium Image has previously been run on the PC.
If the key already exists then there should be one entry for this key:
Name: | RestorePoints |
Type: | REG_MULTI_SZ |
Value: | $AllVolumes$\System Volume Information\*{3808876B-C176-4e48-B7AE-04046E6CC752} /s |
This entry is essential and ensures that the shadow copy diff area is excluded from images. Without this entry images may become unnecessarily large. Don't worry if the entry isn't there, it will be automatically created when the next image is run.
Add new entries(s) for your own exclusions. For example to remove the temp folders you could create one entry as follows:
Name: | TempFolders (This can be any name you wish) |
Type: | REG_MULTI_SZ |
Value: | C:\Windows\Temp\*.* /s |
Note: The type of registry must be Multi-String. You can create as many or as few string values for each registry entry as you wish, but you must press enter at the end of the last string to end the list. In the above example there are 3 lines.
The '/s' text at the end of the path tells VSS to all enumerate all sub folders.
You can also use the variable $UserProfile$ instead of the absolute path. e.g, $UserProfile$\Appdata\Local\Temp\*.* to exclude temp folder files for all user profiles.
More information on the formatting available can be found here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa819132(v=vs.85).aspx