Exclude folder "c:\windows.old" on Image Backup


#1

Is there any way I can exclude the folder “c:\windows.old” on image backup?
Thank you


#2

I understand why you’re asking…but I don’t think so. An Image is an image=everything.


#3

Add it to the FilesNotToSnapshot registry key ( https://docs.microsoft.com/en-us/windows/desktop/backup/registry-keys-for-backup-and-restore#filesnottosnapshot , https://docs.microsoft.com/de-de/windows/desktop/VSS/excluding-files-from-shadow-copies). Microsoft does this for normal Windows updates for example.

(It will delete all the files in this directory and there are a lot of files… so you’ll have to evaluate the performance or if it runs into timeouts with that)


#4

Thank you for the info :wink:


#5

Just delete the Windows.old


#6

Better yet, run disk cleanup before imaging the M$ built in one (clenmgr.exe) as Admin, that gives you the option to get rid of:
Windows.old
Old redundant service pack files
All kinds of stuff from Windows updates
Past memory dumps
Saved error report stuff
Empty IE / Edge cache
Various other trash

Then reboot so windows update knows where it’s at (new updates sometimes fail if you don’t). THEN image

On a mature Windows install you’ll get rid of literally GBs of rubbish in addition to “Windows.old”, and because you did it with the proper tool, there won’t be registry entries pointing to Windows.old, which there would be if you simply deleted it.

Don’t be fooled you can’t use the same method on Windows Server either, by default cleanmgr isn’t there, but it appears if you install the “Desktop Experience” feature in Server Manager, well worth the small footprint for the savings Disk Cleanup provides.


#7

To get cleanmgr.exe on a Windows server, without installing Desktop Experience, run the following commands in a Elevated Command Prompt:

xcopy /Y "C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe" %systemroot%\System32
xcopy /Y "C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe" %systemroot%\System32
xcopy /Y "C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe" %systemroot%\System32

xcopy /Y "C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui" %systemroot%\System32\en-US
xcopy /Y "C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui" %systemroot%\System32\en-US
xcopy /Y "C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_b6a01752226afbb3\cleanmgr.exe.mui" %systemroot%\System32\en-US

cleanmgr.exe

It just copies the executable and its associated MUI files from the resource storage to the System32 folder. There are 3 different ones, to account for different builds of Windows Server.
The Disk Cleanup button will not appear if you open Properties for a drive afterwards, but you can always run cleanmgr.exe from the Start Menu, Run dialog, or Command Prompt.


#8

Useful info, worth noting for anyone reading this later, that running disk cleanup as Administrator, or starting it from an elevated command prompt saves some time waiting for the first scan to finish & then making it scan again when you click “cleanup system files”, since if it runs elevated it scans them for cleanup anyway & you can always uncheck any box you don’t want cleaned up.