Salta al contenuto principale

Backup from unattended batch file

Thread solved
Forum Member
Messaggi: 4
Commenti: 36

I'm trying to fire off a backup task from a batch job.  I can't seem to come up with a solution that will allow an unattended backup.  I can invoke the batch job from an elevated command prompt, but that doesn't solve my problem, I don't want to have to attend to it, this is part of a larger task that will run using task scheduler.

What's the magic words to make the batch job run unattended? :)

0 Users found this helpful
Legend
Messaggi: 106
Commenti: 26366

John, what do you have in your batch command script so far, what are you using here?  Windows .BAT script, Powershell .PS1 script?

See KB 47143: Acronis True Image: How to run backups from Command Line

You can use a .BAT file with Windows Task Scheduler to run your backup with Administrator authority.

Forum Member
Messaggi: 4
Commenti: 36

I followed all that, but I couldn't get it to run.  I changed it to a scheduled job after the previous task that generated the folder to be backed up ran.

Legend
Messaggi: 106
Commenti: 26366

John, can you share your script showing the command you are using?

A script that I have used successfully is:

:: File name = RunATItask.BAT

echo off
set ATI="C:\Program Files (x86)\Acronis\TrueImageHome\TrueImageHomeNotify.exe"
set task=2BF45C62-B17B-4816-B470-9825BDCDC572
%ATI% /script:%task%
exit

If you want to launch the above from the desktop, then create a shortcut to the .bat file and then change the shortcut properties to always 'Run as Administrator' when launched.

Forum Member
Messaggi: 4
Commenti: 36

I do NOT want to manually launch the file, that isn't the problem.  It's when I use Task Manager to launch it, I could never get it to function that way.

Legend
Messaggi: 106
Commenti: 26366

Again, what exactly are you trying to do, what command(s) are you using?

I know that this does work as have used the Task Manager to launch tasks many times.

Forum Member
Messaggi: 4
Commenti: 36

I have the following line in a batch file.

start /min "" "C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe" /script:"08E7AE2E-1E30-4EFB-919E-C86CE63FCF35"

I also tried it without the start.

"C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe" /script:"08E7AE2E-1E30-4EFB-919E-C86CE63FCF35"

image 468

 

Legend
Messaggi: 106
Commenti: 26366

John, the issue shown in the log snippet is related to the Microsoft VSS feature used to create snapshot data and further the issue is being caused by a privilege requirement not being met.

Failed to initialize the snapshot manager library.

A required privilege is not held by the client.

The first check point I would suggest is to ensure that Acronis True Image was installed using an Administrator account as documented / required to work correctly.  If not, then try doing a Repair Install as Administrator or uninstall / reinstall as same.

KB 60915: Acronis True Image: repairing program settings - has details of how to do the repair install.

Forum Member
Messaggi: 4
Commenti: 36

Well, #1, my account is an administrative account, and that's the account that I both installed it under and the account that I specified in Task Scheduler to run the backup.

 

Forum Member
Messaggi: 4
Commenti: 36

Here's the error I'm getting.

1    True Image    8/16/2021 2:35:08 PM    Backup reserve copy attributes: format tib; need_reserve_backup_copy false;
2    True Image    8/16/2021 2:35:08 PM    Operation Thunderbird Snapshot started.
3    True Image    8/16/2021 2:35:08 PM
4    True Image    8/16/2021 2:35:08 PM    The endpoint is a duplicate
5    True Image    8/16/2021 2:35:08 PM    Failed to initialize server.
6    True Image    8/16/2021 2:35:09 PM    Operation has completed with errors.
Legend
Messaggi: 106
Commenti: 26366

John, once again you are drip feeding the information here...

I have never seen ATI report any errors about endpoints, duplicate or not, or about failing to initialize server!  This begs further questions about what exactly you are doing here?

Does this backup task run correctly / successfully when run from within the ATI GUI?
What is the Destination for the backup task?
Are you also trying to run a Pre Command for this task?

Have you tried first creating a test backup task of a single folder & contents to a local destination then tried the script identifier for that task with your batch script after checking that the task runs fine from the GUI?

Forum Member
Messaggi: 4
Commenti: 36

I can run the backup from the GUI or scheduling it within Acronis.  The destination of the backup task is a local disk.  I have no pre or post commands specified in Acronis. 

I'm backing up a copy of my Thunderbird email profile daily. I'm attempting to automate the whole process, so I have a batch job that kills Thunderbird, runs Beyond Compare to generate a local copy of the current profile contents, then starts Thunderbird again.  Now that I have a local copy that is not being operated on by Thunderbird, I use Acronis to generate the compressed backup using a differential scheme.

 

Legend
Messaggi: 106
Commenti: 26366

John, I also use Thunderbird as my main email client and am able to do a backup of this both via the ATI 2021 GUI using a Files & Folders task and also by using a PowerShell script to launch that same task via Windows Task Manager.

In my case, I have moved the Thunderbird profile location to my D: drive so that all the files to be backed up are in D:\Thunderbird rather than in the more obscure AppData folders.

I haven't seen any need to kill Thunderbird when running the backup as it is still using VSS (without writers) to capture snapshot data, plus the source selection doesn't include the volatile cache folders.

In order to use Task Scheduler with my powershell script, I needed to have a local administrator account as it would not allow me to use my Microsoft Account (didn't recognise it! - this is a known issue when the account includes a domain name such as Outlook.com!).

I have attached a zip file with a copy of the powershell script and screen shots of my Task Scheduler task settings.

Note: if you haven't used powershell previously, then you will need to allow scripts to be run on your PC as Microsoft disables this by default.  To enable them, do the following:

Launch Windows PowerShell as Administrator, then type in the command:

set-executionpolicy remotesigned

then answer either Y or A to the challenge shown.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS D:\powershell> set-executionpolicy remotesigned

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
PS D:\powershell>

If you want to see how the script works by running it in PowerShell before using it in the Task Scheduler, then launch the Windows PowerShell ISE application instead of the above.

Repeat the set-executionpolicy remotesigned for that environment (only needed to be done once for each different setting).

Open the Run_ATI_Task.ps1 script in the ISE and change the View to show the script panel at the top of the window.  You can use the edit panel to change the script identifier in line 9 to the id of your own backup task, then when you want to run the script click on the arrow shown at the top or press the F5 key.  The actions being performed are shown in the lower panel.

Note: the script checks for and kills ATI if already launched but lets any active task finish!  This is to let the task run in the background.

Allegato Dimensione
585506-290309.zip 650.92 KB
585506-290314.png 90.03 KB
585506-290317.png 101 KB
585506-290320.png 102.63 KB
Forum Member
Messaggi: 4
Commenti: 36

No offense, but that really looks complicated! :D  Do I really have to do all that just to get TI to run from the command line?

Legend
Messaggi: 106
Commenti: 26366

John, is there a reason why you don't want to use the Acronis scheduler to do what you want here?  That would be the simplest solution to use.

You could use a Pre Command .BAT file to close Thunderbird if it is running when the backup is due to run, then use a Post Command .BAT file launch it again when done.

Forum Member
Messaggi: 4
Commenti: 36

I'm actually trying the Acronis Scheduler now.  I'm doing an experiment to see if the VSS works well enough that I don't have to shutdown TB for the backup.  The issue with shutting down TB is bringing it back only works about half the time.  For some reason, sometimes TB comes up without it's screen display, then you have to use Task Manager to kill it before you can start it up.

I just have to figure out if VSS is protecting the integrity of the profile email files with TB running.

It shouldn't be this hard to backup my email!

Legend
Messaggi: 106
Commenti: 26366

John, there is another method that you can use here in conjunction with Pre & Post commands for your Thunderbird backup task.

First, download a copy of the Microsoft Sysinternals PsSuspend tool and unzip this from the PsTools.zip file it comes in.

Next, in ATI, edit the Pre / Post Commands and select the PsSuspend64.exe for the Pre & Post commands so that you have entries that look like those in the image below:

Note: run the pssuspend64.exe file from a command prompt before trying to test the above in ATI as you need to accept the license agreement on the first run.

The tool will suspend the Thunderbird process(es) for the duration of the backup operation, then resume them again when finished.

The log for the backup task is shown in the next image below (from ATI 2021).

Using the pssuspend tool avoids the need to kill the Tbird process and relaunch it later.

Forum Member
Messaggi: 4
Commenti: 36

That looks promising, and it would solve the problem of getting TB started again.  I'm not sure why TB doesn't fully terminate when I kill it.  When I look with Task Manager, I don't see it anywhere, but when I started it again, it doesn't bring up the GUI for some reason.

I'll give this a try and see how it works out, thanks!

Forum Member
Messaggi: 4
Commenti: 36

OK, that works, I have one remaining cosmetic issue I'd like to solve. 

For whatever reason, the commands entered as you show yielded an error when I tested them when entered directly into the TI pre & post command options.

If I put them in a simple batch file, they work, but then a command window flashes up each time they run.  Not a big thing, but I'd like to eliminate that.  Note that I copied the pssuspend64.exe file to the C:\BAT folder.

Here's the failing command, the successful one, and the contents of the batch file.  I also tried start /min in front of the command, but that had an error as well.

Allegato Dimensione
585693-290536.png 17.73 KB
585693-290537.png 17.98 KB
585693-290538.png 5.59 KB
Legend
Messaggi: 106
Commenti: 26366

John, try moving the argument for the command down to the box provided for it.


The folder where the pssuspend64.exe program is stored shouldn't make any difference but the arguments being passed to it need to be passed correctly.

Forum Member
Messaggi: 4
Commenti: 36

Moving the arguments worked, one hurdle jumped.  I was just following the example you posted, I wonder why it didn't work for me?

I still get the command window that pops up, I guess I'll have to live with that for now.

Thanks for all your help, I had forgotten all about the Sysinternals tools.

Forum Member
Messaggi: 4
Commenti: 36

I am back to trying to eliminate the command window popping up when running, I can't seem to lick this one.

Legend
Messaggi: 106
Commenti: 26366

Forum Member
Messaggi: 4
Commenti: 36

Can I run the VBS file directly from the Acronis TI configuration for pre and post commands, or do I have to call it with a batch file?

Legend
Messaggi: 106
Commenti: 26366

No, VBS script will need to be called from a batch file.

Forum Member
Messaggi: 4
Commenti: 36

Actually, it appears to work.  I figured why not test it, only takes a minute.  I just dropped the link to the VBS script into the Acronis configuration, works just fine.

image 524

Thanks for the info, I think I'm set now. 

The reason I wanted this was the command window would pop up and steal the focus when I was working and occasionally screw something up as I typed.  Now it truly runs in the background without interrupting my work.

Legend
Messaggi: 106
Commenti: 26366

Glad that you have this working John, I very rarely touch VBS but useful to know!

Forum Member
Messaggi: 4
Commenti: 36

I was a bit surprised that it worked, however they mentioned running it directly from a command prompt, so I figured it would be worth a shot, cut out a couple of extra files and links. :)

The backup ran a while ago, and I never even noticed until the completion email came in, mission accomplished! :D

Forum Member
Messaggi: 4
Commenti: 36

Well, I thought I had it licked.  My Thunderbird backup runs some of the time, and then fails some of the time.  Oddly, I don't get an email when it fails with the log.  How can I find out why it fails? 

I can open Acronis and run the backup from the desktop and it runs every time.  It seems to fail after the screen blanker has blanked the screen or after the computer enters sleep mode, but none of the other backups ever fail for that reason.  Usually, a backup that hasn't run simply runs the next time it gets the chance.

Here's what I see, but I have no idea why it failed.  Where does Acronis hide the log files?

 

image 526

I have tested the email message and I can send a test message successfully, so I'd think it should send out and email indicating why the backup failed.

 

Legend
Messaggi: 106
Commenti: 26366

John, check your Advanced settings on the Scheduler page for your backup task and ensure that you have the option to prevent computer going to sleep ticked and to wake the computer from sleep when the task is due to run.

Forum Member
Messaggi: 4
Commenti: 36

 Yep, both of those are checked in all my backup jobs.  I also don't check the idle option as I just want them to run busy or not.

image 532

Note that a log for the missing backup doesn't show up at all, it is scheduled to run at 12:30 every day.  It ran perfectly for a few days on it's schedule at first.  I'm most confused by the fact that nothing shows up at all for this task, yet the task that runs 30 minutes later runs on time every time!

You can see the run at 13:00 that runs like clockwork every day, the run at 12:30 with all the same options just doesn't appear at all!

image 535

Here's a successful scheduled run, just like it should every day.

image 534

Here's a successful run email with the log for the task.  This is the last time it ran automatically, and I haven't changed any configuration since then.

image 536

The only thing that comes to mind is it's dying on the pre-run task, but I would think it would generate a log file if it were actually being invoked!

Legend
Messaggi: 106
Commenti: 26366

John, the best way forward for being able to help you here would be if you could create an Acronis System Report zip file and share this with me via a cloud share link (via such as OneDrive, Dropbox, Google Drive etc).

That would let me look at the other logs involved to see if the missing task actually launches or not?

Forum Member
Messaggi: 4
Commenti: 36

I have it in dropbox, how do I share it with you?

Forum Member
Messaggi: 4
Commenti: 36

OK, I sent you a message with the shared link to the system report.

Legend
Messaggi: 106
Commenti: 26366

John, thanks for the system report information.

The scheduler2 log shows that Acronis is attempting to run the scheduled backup tasks but doesn't really show (at least to me) why it doesn't progress to completion?

Some examples:

<uuid>08E7AE2E-1E30-4EFB-919E-C86CE63FCF35</uuid>
<display>Thunderbird Snapshot</display>
Task   1-20
Time: 12:30:00
Type: daily
Last tried: 29.10.2021 13:41:04 as MANUAL

28/10/2021 12:30:01:250 PM 00001A4C Trying task 1-20 as TIME_NORMAL
28/10/2021 12:30:01:250 PM 00001A4C Init delay
28/10/2021 12:30:01:250 PM 00001A4C OnServiceMainWake: next time = 28.10.2021 12:35:01
28/10/2021 12:35:02:262 PM 00001A4C OnServiceMainWake: begin
28/10/2021 12:35:02:262 PM 00001A4C Trying task 1-20 as TIME_DELAYED
28/10/2021 12:35:02:262 PM 00001A4C Windows fast startup state to disable: ENABLED PRESENCE
28/10/2021 12:35:02:262 PM 00001A4C Windows fast startup state disabled: BACKUP PRESENCE
28/10/2021 12:35:02:262 PM 00001A4C OnServiceMainWake: next time = 28.10.2021 13:00:00
28/10/2021 12:35:02:262 PM 000030CC API Reply: OP=WAIT_CHANGES_EX Ver=4 Status=0 Task=1-20 Result=3(RUN_WAITED) Extra=9(TIME_DELAYED)
28/10/2021 12:35:02:262 PM 00001A5C Running task 1-20
28/10/2021 12:35:02:293 PM 00001A5C LogonUser: < domain="MAIN" user="John Will" > error=0
28/10/2021 12:35:02:293 PM 00001A5C NewSecurityDescriptor: > error=0
28/10/2021 12:35:02:293 PM 00001A5C SetTokenInformation: > error=0
28/10/2021 12:35:02:293 PM 00001A5C Scheduler user for account found
28/10/2021 12:35:02:293 PM 00001A5C Session found
28/10/2021 12:35:02:293 PM 00001A5C DuplicateTokenEx: < token=0000000000000380 > error=0 token=0000000000000424
28/10/2021 12:35:02:293 PM 00001A5C CreateEnvironmentBlock: > error=0
28/10/2021 12:35:02:293 PM 00001A5C GetVistaLinkedToken: < token=0000000000000424 > error=0 token=0000000000000538
28/10/2021 12:35:02:293 PM 00001A5C CreateProcessAsUser: < token=0000000000000538 > error=5
28/10/2021 12:35:02:293 PM 00001A5C Windows fast startup state to enable: BACKUP PRESENCE
28/10/2021 12:35:02:293 PM 00001A5C Windows fast startup state enabled: ENABLED PRESENCE
28/10/2021 12:35:02:308 PM 00001A5C Runner wait for 4294967295 ms

29/10/2021 12:30:01:481 PM 00001A4C OnServiceMainWake: begin
29/10/2021 12:30:01:481 PM 00001A4C Trying task 1-20 as TIME_NORMAL
29/10/2021 12:30:01:481 PM 00001A4C Windows fast startup state to disable: ENABLED PRESENCE
29/10/2021 12:30:01:481 PM 00001A4C Windows fast startup state disabled: BACKUP PRESENCE
29/10/2021 12:30:01:487 PM 00001A4C OnServiceMainWake: next time = 29.10.2021 13:00:00
29/10/2021 12:30:01:487 PM 000046DC API Reply: OP=WAIT_CHANGES_EX Ver=4 Status=0 Task=1-20 Result=3(RUN_WAITED) Extra=8(TIME_NORMAL)
29/10/2021 12:30:01:487 PM 00001A5C Running task 1-20
29/10/2021 12:30:01:534 PM 00001A5C LogonUser: < domain="MAIN" user="John Will" > error=0
29/10/2021 12:30:01:534 PM 00001A5C NewSecurityDescriptor: > error=0
29/10/2021 12:30:01:534 PM 00001A5C SetTokenInformation: > error=0
29/10/2021 12:30:01:534 PM 00001A5C Scheduler user for account found
29/10/2021 12:30:01:534 PM 00001A5C Session found
29/10/2021 12:30:01:534 PM 00001A5C DuplicateTokenEx: < token=0000000000000380 > error=0 token=0000000000000440
29/10/2021 12:30:01:534 PM 00001A5C CreateEnvironmentBlock: > error=0
29/10/2021 12:30:01:534 PM 00001A5C GetVistaLinkedToken: < token=0000000000000440 > error=0 token=0000000000000240
29/10/2021 12:30:01:550 PM 00001A5C CreateProcessAsUser: < token=0000000000000240 > error=5
29/10/2021 12:30:01:550 PM 00001A5C Windows fast startup state to enable: BACKUP PRESENCE
29/10/2021 12:30:01:550 PM 00001A5C Windows fast startup state enabled: ENABLED PRESENCE
29/10/2021 12:30:01:550 PM 00001A5C Runner wait for 4294967295 ms

Forum Member
Messaggi: 4
Commenti: 36

I figured it wasn't running, what I can't figure out is why a seemingly identical task runs reliably half an hour later!  I'm somewhat at a loss as to what to look for since the two configurations seem almost identical.  None of the files being backed up or the backup storage location can be off-line, they're local SSD drives..

I turned off the tasks that disable and enable TB running before & after to see if that will change it.

If that doesn't work, I think I'll try flipping the order, run the other backup that works every time to 12:30 and run this one at 13:00.

Other than that, I can't imagine what else to do!

Legend
Messaggi: 106
Commenti: 26366

John, I would suggest removing the Pre / Post Command from the task then trying it again on schedule to see if that makes any difference?

Next, you seem to have quite a lot of scheduled tasks - can you increase the timing so that any tasks due to run prior to and after the TB task allow more time for each to complete and avoid any potential for conflicts?

Forum Member
Messaggi: 4
Commenti: 36

As I stated, I did turn off the pre & post tasks to see if that helps.  I'll know in a day or two.

I only have three scheduled tasks, the other four are on-demand to backup to off-line storage, so I don't see any potential for conflict there.  The two are scheduled half an hour apart, but they only take a few minutes max, so there shouldn't be a conflict.  I have booted the machine later in the day and had all the tasks queue up and run properly one at a time, so I didn't think that was an issue. 

In an effort for covering all bases, I spread the three out to at least an hour and a half spacing.

 

Forum Member
Messaggi: 4
Commenti: 36

No joy with the removal of the before and after tasks.  The task still got an error, and the seemingly identical task that runs now one and a half hours later ran without an issue.

I ran the TB backup task manually, and of course it runs fine and completes normally.

At this point, I think I'll delete that task and recreate it from scratch and see if something odd has been stored in that task description.

Forum Member
Messaggi: 4
Commenti: 36

Well, I'm truly befuddled now!  I deleted the backup task and created it from scratch.  I also compared all my settings with the task that runs flawlessly an hour and a half later now, other than the source and destination, they are identical!  It still errors out when it attempts to run.

The only thing I can imagine is for some reason when Acronis runs via the scheduler that it can't access the Thunderbird folder in the AppData folder, nothing else makes sense! 

image 533

Legend
Messaggi: 106
Commenti: 26366

John, you may be correct with regards to the AppData folder.  I have not used that default location for my mail for some years, so my own is in my D:\Thunderbird and hasn't had any of the issues you are seeing.

See webpage: Moving your profile folder

Forum Member
Messaggi: 4
Commenti: 36

Good point, I could certainly try that.

Forum Member
Messaggi: 4
Commenti: 36

I'm officially defeated!

I don't have a clue why this doesn't work!  I moved the Thunderbird profile to my data drive, got all that working, and then fired off the backup.  If fails with no log file exactly the same way!

When I open up TI, I can simply click on Back up now and away it goes without a hitch.

This is after I cloned a working task and just changed the source and destination folders to the appropriate locations.  The original task that I cloned works fine in the background without missing a beat.  FWIW, I'm using D:\Thunderbird as my new profile location.

I think it's time for me to look for a different method of doing this backup, clearly for whatever reason Acronis TI isn't going to do it.

Legend
Messaggi: 106
Commenti: 26366

John, sorry that you are still having issues with this task requirement.  The only other thought is that it is an issue with ATI 2016 for which the only solution would be to upgrade or find a different backup solution!

Upgrading is a totally other bag of worms since Acronis have abandoned perpetual licenses with ATI 2021 and ACPHO versions onwards.

For myself, I don't backup Thunderbird separately as a Files & Folders backup task - it gets backed up regularly with my Disks & Partitions backup of my D: drive.

I use the Synology Drive Client application to capture immediate changes to my Thunderbird data direct to my NAS in a way that is akin to using OneDrive, Dropbox etc.

Forum Member
Messaggi: 4
Commenti: 36

I actually added the new D:\Thunderbird folder to my daily data backup as well as having the separate run.  I'm curious to see if adding that breaks the previously working data backup job! :)

The reason I don't upgrade Acronis is exactly what you stated, I'd have to start paying every year, that's a bit too much.  I used to upgrade when a new version of Windows came out, but when I upgraded to Win10, I noticed that I was only buying a year and then I had to upgrade.  Having a backup solution that self-destructs after a year is no backup!

I have an older Synology NAS, but it appears that Synology Drive Client isn't compatible with my version.

However, I may look into synchronizing TB with my MEGA account, I have plenty of capacity there.

I'm still at a total loss why one job fails and the other one runs without issue!

Legend
Messaggi: 106
Commenti: 26366

John, my Synology NAS is getting on some years now - DS215j and that got the latest Drive Client a few months back after running an older version.

Forum Member
Messaggi: 4
Commenti: 36

I looked and they said I needed 6.xx for the Drive client, I have 4xx as that's the latest one for the DS209.

Legend
Messaggi: 106
Commenti: 26366

OK, then your DS209 is very old if you are only on DSM 4xx - my DS215j has been updated to DSM 7 a few months back.

Forum Member
Messaggi: 4
Commenti: 36

The 4.xx was the last version for the DS209, but the NAS has served me well, and other than a disk dying a couple years back, it's always been 100%.  The beauty of mirrored disks, I just popped another one in and let it rebuild.  I also have a USB drive connected to the Synology that keeps a complete copy of the mirrored disks in case of a complete disaster, just in case. :)

I did find the last perpetual license 2021 Acronis TI on Amazon, so I ordered it.  I plan on being disappointed after the upgrade, but we'll see.

Forum Member
Messaggi: 4
Commenti: 36

In a totally confusing turn of events, adding the D:\Thunderbird folder to the backup of a bunch of other daily backups worked just fine, at least once.  The reason I wanted to keep Thunderbird separate was simply because I felt that suspending TB execution was probably a good idea when I was actually backing up the files.  However, it appears I'll have to trust VSS if this continues to function.

Legend
Messaggi: 106
Commenti: 26366

John, I have been doing regular scheduled backups that include my own D:\Thunderbird folders for many years and have never had to suspend TB etc and haven't hit any issues with VSS grabbing a snapshot of the data.