That trick works;
Scenario: got an old, quite power hungry machine in my attic with lots of old drives running urbackupsrv, 3 times a day it is woken up by my home automation and resumes from hibernation. My father has a laptop, he lives somewhere remote. I configured a dummy task on his windows laptop to wake it up at 3am, at the same time my backup server resumes from hibernation. In the logs and the “last seen” i can see they communicate/see each other, however the laptop is gone before the backup is finished. If i had my backup server running 24/7 this would not be an issue of course, but this is just for personal/family use and like mentioned the machine in the attic is quite power hungry so i want it to be on only when needed.
I found this: Option to inhibit sleep during backup and Uroni claims urbackup should prevent the laptop to go back to sleep. Unfortunately that doesn’t seem to be the case.
I have written 2 scripts for the laptop, pre- and postfilebackup.bat that should change the power scheme to performance temporarily when the backup is running. I still need to test these, and of course you could adopt these to the pre- and postimagebackup.bat files if needed.
prefilebackup.bat:
:: Commands in this file will be executed before each incremental or full file backup
powercfg -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
postfilebackup.bat:
:: Commands in this file will be executed after each incremental or full file backup
powercfg -SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e
This assumes you have the “balanced” scheme set as default, you can find the GUIDs of the available schemes via
powercfg -LIST
the current set scheme is indicated with an asterisk (*), or you can run powercfg -GETACTIVE
to obtain its GUID, which could be usefull if you want to make sure it will always return to its former state. More info on the powercfg command here: Powercfg command-line options | Microsoft Learn
So please note 3 remarks: untested and assumptions, the above GUIDs come from Windows 8.1, my father runs Windows 11, i am not sure if the GUIDs are universal or what power scheme he is running as default, so i will need to figure that out first running the mentioned commands. Lastly i noticed the post script is only run after the backup is finished, what if it doesnt? Also i dont know what the performance scheme does when the battery is really empty, does it still shut down/hibernate/sleep or will it keep running until there is no more juice? I happen to know my father mostly keeps his laptop on the ac adapter at night, and file backups only take a couple of minutes, so i am not to worried about these things atm.
For those interested in how to wake up a client from sleep; indeed i used the “dummy task” trick, (more info How to Set PC Wake Up Timers | Laptop Mag) but digging into this powercfg command i find there is a perhaps a caveat; it seems you can dis- and enable wake up timers depending on if the client is on ac power or battery, so if the client doesnt wake up, make sure wake up timers are enabled in the power scheme.
some references:
https://www.makeuseof.com/how-to-schedule-your-windows-10-pc-to-automatically-wake-each-day/