[Solution] [PowerShell script] How to delay start of Aomei Backupper Service

I had the annoying issue that scheduled backups started right after booting my Windows PCs, however the NAS (i.e. the backup destination) was not yet ready at this time because it was in sleep mode. So these backups failed all the time and unfortunately Aomei Backupper's network timeout is far too short.

I found two ways to solve that problem, an easy and a sophistacted one:
  1. Delayed service start of the backupper service
  2. Full control of NAS readiness and delayed Backupper service start by a PowerShell script

1. Delayed service start of the backupper service
Scheduled Aomei backups are started from the 'Backupper Service' (ABService.exe). If we can delay the start of that service, the problem would be fixed. Windows 10 offers the possibility to delay service starts.
  • Open 'services.msc' and find 'AOMEI Backupper Scheduler Service'
  • Change 'Start type' from 'Automatic' to 'Automatic (delayed start)'. This will delay the service start by 120 seconds.
This first approach works, but there are drawbacks:
  • 120 seconds might not be enough to boot the NAS (as in my case). You could create a new registry key named 'AutoStartDelay' as 'DWORD value (32 bit)' under 'HKLM\SYSTEM\CurrentControlSet\Control' and set a higher value (in milliseconds) - but this setting applies for all services in your system.
  • The startup type of Backupper service would be reset back to 'Automatic' after upgrading to a new Aomei version, you'd have to remind yourself to set it again to 'Automatic (delayed start)'.
  • On a Windows 10 system with 'fast boot' on (which is the default), services don't get really stopped at shutdown, but they continue running after next boot. 'Fast boot' is rather a hibernate state, not a real system shutdown. So either you have to turn off fast boot or this approach won't work.
So I came to a more sophisticate, but also more robust and flexible solution:

2. Full control of NAS readiness and delayed Backupper service start by a PowerShell script
In a nutshell, when a Windows client starts, the script first issues a Wake On Lan (WOL) packet to the NAS. Then it waits until the NAS is ready by requesting an HTTP ressource. Once as the NAS is ready, the Aomei Backupper Service gets started. Scheduled backups may now get started by the backupper service.

On shutdown the backupper service gets explicitly stopped. Otherwise it would continue running after reboot on a fast boot system.

The script gets started either by Windows Group Policy Logon and Logoff scripts (recommended way) or by the Task Scheduler startup event. Please find more detailled installation instructions inside the script.

I share my script "as is", you'll have to adjust it (a bit) for your needs, it will not run out of the box in your environment. Anyway, I think it might be helpful for others having the same issue. It might also be helpful as a starting point to delay any other service start until conditions are fulfilled.

The script runs smoothly in my environment on a couple of Windows PCs (Windows 10 Pro and Home) - no failed backups anymore, and an annoying issue is solved :) However, my solution is still kind of a workaround. What I'd really prefer is that Aomei would deal and fix that issue in their software. I think it's not such an exotic case that an external backup destination, like a NAS in most cases, needs some time to get ready before backup can write to it. I think there are better alternatives than failing with error code 303 ("invalid network path") when the backup destination is not yet ready. I'd suggest to make the network timeout configurable.
Sign In or Register to comment.