Sorry for being unclear.
The whole command looks like that:
restic backup -r D:\test C:\ –use-fs-snapshot --no-scan --pack-size 64 --exclude [some excludes]
It runs as administrator, restic is whitelisted in Windows Defender.
The output (some lines):
error: open \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy6\Users.…\AppData\Local\Microsoft\WindowsApps\SnippingTool.exe: The file cannot be accessed by the system.
error: open \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy6\Users.…\AppData\Local\Microsoft\WindowsApps\Spotify.exe: The file cannot be accessed by the system.
error: open \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy6\Users.…\AppData\Local\Microsoft\WindowsApps\SpotifyAB.SpotifyMusic_zpdnekdrzrea0\Spotify.exe: The file cannot be accessed by the system.
error: open \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy6\ProgramData\Packages\Microsoft.YourPhone_8wekyb3d8bbwe\S-1-5-21-4024458782-2530143891-2336270728-1002\SystemAppData\Helium\Cache\2bd14e1c612a254e.dat: Access is denied.
error: open \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy6\ProgramData\Packages\Microsoft.YourPhone_8wekyb3d8bbwe\S-1-5-21-4024458782-2530143891-2336270728-1002\SystemAppData\Helium\Cache\2bd14e1c612a254e_COM15.dat: Access is denied.
error: open \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy6\ProgramData\Packages\Microsoft.YourPhone_8wekyb3d8bbwe\S-1-5-21-4024458782-2530143891-2336270728-1002\SystemAppData\Helium\Cache\2bd14e1c612a254e_COM15.dat.LOG1: Access is denied.
error: open \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy6\ProgramData\Packages\Microsoft.YourPhone_8wekyb3d8bbwe\S-1-5-21-4024458782-2530143891-2336270728-1002\SystemAppData\Helium\Cache\2bd14e1c612a254e_COM15.dat.LOG2: Access is denied.
Most of the files, if not all, aren’t necessary if I would reinstall the OS by hand and then restore the user folders, but they are probably critical if I want to do a bare metal restore without any more steps to do.
To be honest - I don’t know if these files were included in the Veeam backup. Veeam never complained about access problems and the restore was successful.
Unfortunately I’m not able to run a test restore, because I don’t have a spare machine that I could use without risking to ruin the OS.
After investigating a bit more. I realized that the files which are responsible for the “cannot be accessed by the system.” are actually links. The dir command shows -a—l as mode for these files.
The “access denied” files seem to be files and directories that belong to the SYSTEM user and I don’t have any rights on them.
I suppose, that they don’t need to be in the backup, but I’m not sure.
The question now ould be: Is there a way to automatically exclude files that don’t belong in the backup because they are links, protected system files or cloud - only online files without manually adding them to the exclude list?
The other question would be how to find out if the files really don’t belong in to a backup, but I think this is not the right place for such a question.