How is automatic cleanup of File History triggered in Windows 8.1 and 10?

1

I've set up File History in Windows 8.1 to delete backups older than one month, but that automatic cleanup is not working: The backup target contained files many months older. Cleaning up manually using the GUI provided by File History worked, as well as doing it on the shell using fhmanagew.exe -cleanup [...]. Creating the backups work as well, they are as current as expected.

There's the following task in the task planner:

\Microsoft\Windows\FileHistory\File History (maintenance mode)

But I don't see from its naming, description, triggers etc. if it does backups only or cleanups as well. It's called [...] (maintenance mode), which makes me believe it should handle both, but monitoring the execution after manually triggering the task using Process Monitor, I have the feeling that it handles backing up itself only. But there needs to be some place which triggers cleaning up old data or it needs to be combined with backing it up, either running before or afterwards.

My ultimate goal is that I would like to trigger the cleanup as it happens normally to monitor the behaviour regarding file permissions and stuff like that. But currently I don't know what gets triggered where when to clean things up.

So, how is automatic cleanup of File History triggered in Windows 8.1 and 10?

Thorsten Schöning

Posted 2019-07-09T13:24:44.823

Reputation: 523

Looks like automatic cleanup is not triggered automatically (I've tested it on my computer). Runing fhmanagew.exe using Task Scheduler seems to be the only workaround. – w32sh – 2019-07-13T07:54:51.737

@w32sh Which version of Windows? Do you suggest this is a bug or simply a misunderstanding on my site? I always assumed cleanup gets triggered automatically and never read that one needs to care manually. When reading about cleaning up manually, it's always because a lack of space or problems or such, not about necessary normal usage. – Thorsten Schöning – 2019-07-13T12:13:58.490

Windows 10 v1903. haven't had a chance to test in earlier builds. But I think it's a bug. I'm yet to check if someone has raised this issue in the Windows 10 Feedback tool. – w32sh – 2019-07-13T12:20:11.147

@w32sh My client used Windows 8.1 instead with all updates applied. – Thorsten Schöning – 2019-07-13T12:24:05.247

Answers

0

Currently the answer seems to be that despite one being able to configure which backups to keep in the GUI, there is no automatic cleanup of File History in Windows by default. Instead it seems that users are expected to do it manually using the provided GUI or create e.g. a task in the Task Scheduler to do it automatically in the background. The latter is pretty easy by using fhmanagew.exe -cleanup ... -quiet, while providing -quiet is important to not show any dialogs after the process successfully finished.

Others simply come to the same conclusion:

I have configured File History to retain the versions stored within the last one month. However, the File History store shows much older versions of files are intact. The automatic cleanup is not working, and we don’t know if it’s by design or not. Or is it possible that the older versions are purged automatically when the hard disk becomes full? We’re not sure. Windows doesn’t seem to have a task that triggers the cleanup the older File History versions.

I'm somewhat sure that Windows doesn't purge old backups in case disk storage gets full, because that's exactly why I had a look at the problem: I'm backing up to some NAS and that ran out of space because of the backups of File History, so there surely is no automatic cleanup under that condition as well.

The above link contains additional useful undocumented arguments to fhmanagew as well:

Run File History backup on demand, manually.
FhManageW -backupnow

Stop File History backup that’s currently running
FhManageW -stop

Open File History settings page:
FhManageW -autoplay

Checks (Error checking) the drive assigned as the File History backup drive:
FhManageW -checktarget

Thorsten Schöning

Posted 2019-07-09T13:24:44.823

Reputation: 523