Sorry for the very long delay in replying, I got distracted by other things. I took another look at this issue.
Mildur wrote: ↑Oct 10, 2023 9:43 amCan you work around the limitation by starting the backup at a logoff event? You may have to configure
Back up no more often than every for 12 hours to not have a backup every time you logoff.
I didn't try this because it's, well, a workaround, and one that only seems marginally better than just letting Veeam run the backup as soon as the PC wakes (which is the
de facto Veeam default behavior in a Modern Standby world).
I do have some good news, however: I did manage to get Veeam to run during a Modern Stanby "maintenance window" as I was alluding to in my previous post!
The way I did it is by creating a Windows Task Scheduler task that uses the
Veeam Agent Command Line Interface to run a backup. The command waits for the backup job to complete before finishing, which is a good thing since it keeps the scheduled task in the "running" state thus preventing Windows from going back to sleep while the backup job is running.
I manually exported, edited and re-imported the scheduled task XML file to add the
relevant configuration for an automatic maintenance task (I couldn't find a way to do this using the Task Scheduler GUI). For reference I ended up with a Scheduled Task that looks like this (note the <MaintenanceSettings> section):
Code: Select all
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2023-12-18T14:52:51.1735121</Date>
<Author>(snip)</Author>
<URI>\Veeam backup</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2023-12-19T02:00:00</StartBoundary>
<ExecutionTimeLimit>P1D</ExecutionTimeLimit>
<Enabled>true</Enabled>
<RandomDelay>PT1H</RandomDelay>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-18</UserId>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>StopExisting</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
<NetworkSettings>
<Name>(snip)</Name>
<Id>{2D8F33DC-614D-425E-8334-DBCDF7468BBD}</Id>
</NetworkSettings>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<MaintenanceSettings>
<Period>P1D</Period>
<Deadline>P5D</Deadline>
<Exclusive>false</Exclusive>
</MaintenanceSettings>
<WakeToRun>true</WakeToRun>
<ExecutionTimeLimit>P1D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>"C:\Program Files\Veeam\Endpoint Backup\Veeam.EndPoint.Manager.exe"</Command>
<Arguments>backup 54216ddc-6733-4ef5-9e31-275ca4f7fc70</Arguments>
</Exec>
</Actions>
</Task>
And lo and behold, it works! `powercfg /sleepstudy` confirms the computer woke from Modern Standby because of my "Veeam Backup" scheduled task:
One thing that's a bit tricky here though is that Windows will kill the task
if it takes more than 1 hour to run. This is a problem if the backup takes more than 1 hour (e.g. lots of changed files, long incremental backup merge, etc.). Unfortunately that 1-hour hard deadline does not seem to be configurable. However the docs do describe a mechanism by which the task will be given more time to complete if it fails multiple times in a row. Maybe that's good enough - I don't know as I haven't seen that mechanism in action yet.
Another issue with this approach is that, as explained in the
Veeam docs, when triggering a backup job from the command line some Veeam settings are ignored, such as network restrictions. Fortunately Windows makes it possible to configure a Scheduled Task to only start if a specific network is accessible. It's not as flexible (e.g. can't select multiple networks) but it's one way to work around this limitation I guess.
I think Veeam devs should seriously consider integrating more cleanly with this mechanism. Modern Standby is here to stay, so this problem will only get worse over time as more and more Windows PCs adopt this paradigm. Ideally the Veeam Agent should automatically install and enable a Windows task to run within the maintenance window. That task could either just "ping" Veeam's own scheduler so that it can take over, or it could just replace Veeam's scheduler entirely. Additionally, the Veeam agent needs to behave more gracefully when faced with the 1-hour deadline. According to Microsoft docs, the recommendation is that the task should be designed such that it can be interrupted and then resumed later - this would imply the Veeam agent needs a new feature where a backup job can be stopped and then resumed later (without having to restart it from scratch). (Honestly this would seem generally useful regardless, as backups can be interrupted for many reasons anyway, e.g. loss of network, and it would be nice if they could just gracefully resume as soon as the system has recovered) I think the ideal behavior would be for the Veeam agent to try to complete the backup within the 1-hour window, and if it can't then it can either rely on the "emergency maintenance window" (maintenance deadline option) to finish the backup job from where it was interrupted, or it could simply resume it as soon as the computer wakes up again.