resticprofile
resticprofile copied to clipboard
Windows 11 hide backup window when backup runs as Windows Task for non-admin user
Thanks so much for resticprofile. It's really great.
I want to configure a scheduled backup on a Windows 11 PC for a user who does not have administrative privileges. Everything works except every time the backup runs a window is visible to the end user. I am able to manually change the Windows task created by resticprofile to make the process hidden when the backup runs. I'm hoping it is possible to add this as a feature to resticprofile.
The user does not have administrative privileges on the Windows 11 PC, so I configured the profile with schedule-permission=logged_on_user. When I run resticprofile schedule, resticprofile creates a task in Windows Task Schedule to "Run only when the user is logged on", which is correct. It also creates one action for the task to "Start a Program" with these parameters:
- Program/Script = resticprofile.exe
- Add arguments (optional) = --no-ansi --config myconfig.yaml run-schedule backup@myprofilename
- Start in (optiona) = same folder which has myconfig.yaml
This results in the backup task being run automatically. However, every time it runs the process window pops up to the end user. This is distracting and also allows the user to terminate it, which I want to avoid.
I can manually change the action in the task to make it hidden. It would be great for resticprofile to do this automatically. Here is how I can change the task to make it hidden when it runs from the end user. I change the "Start a Program" action to have these parameters:
- Program/Script = conhost.exe
- Add arguments (optional) = --headless powershell.exe -command "resticprofile.exe --no-ansi --config myconfig.yaml run-schedule backup@myprofilename"
- Start in (optional) = same folder which has myconfig.yaml (no change to how resticprofile does it already)
Essentially, this wraps the existing resticprofile comamnd line in a conhost.exe process that runs it headless. This works on recent windows 11 versions. On older versions of windows, conhost.exe is not installed, so there would be another way to hide the window using a vbs script. However, vbs scripts are now deprecated by Microsoft who now recommends to use conhost.exe to run processes hidden.
Is it possible to make this the default for resticprofile? I am running version 0.29.1.
Hey
I wouldn't want to make it the default when using user_logger_on, but we can add an option to activate it: something like schedule-hidden: true would work.