@ECHO OFF REM REM Variables - update as required REM SET BACKUPNAME=Dell8700-107 SET BACKUPSCRIPT=6B1278D8-4926-45B1-8FE5-33902F4DF1B5 SET BACKUPLOG=c:\users\Stephane\Desktop\BackupLog.txt REM REM Command - need to run as administrator REM REM "C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe" /script:"TASK_ID" REM REM How to get Task_ID REM REM Open the folder C:\ProgramData\Acronis\TrueImageHome\Scripts REM REM Open each file in that folder in a text editor, e.g. Notepad, until you find the file with the backup REM name in between and on the 5th line. REM Copy everything in between and on the line above that. This is the TASK_ID REM REM Warning: do not use :: for comment as it cause strange error in if block statement REM ECHO. ECHO Computer Backup Script %BACKUPNAME% started on %date% %time% ECHO Computer Backup Script %BACKUPNAME% started on %date% %time% >> %BACKUPLOG% ECHO. IF /I "%1"=="SHUTDOWN" ( ECHO Shutdown requested after backup done ECHO Shutdown requested after backup done >> %BACKUPLOG% ) ELSE ( ECHO Shutdown NOT requested after backup done ECHO Shutdown NOT requested after backup done >> %BACKUPLOG% ) ECHO. REM REM Checking for Administrator Rights REM ECHO Checking for Administrator Rights ECHO Checking for Administrator Rights >> %BACKUPLOG% ECHO. NET SESSION >nul 2>&1 IF %ERRORLEVEL% EQU 0 ( ECHO Administrator Rights detected ECHO Administrator Rights detected >> %BACKUPLOG% ECHO. ) ELSE ( ECHO Administrator Rights NOT detected. Aborting! ECHO Administrator Rights NOT detected. Aborting! >> %BACKUPLOG% ECHO. PAUSE EXIT ) ECHO Checking if Secure S:\ Drive is mounted and unlocked ECHO Checking if Secure S:\ Drive is mounted and unlocked >> %BACKUPLOG% ECHO. IF NOT EXIST S:\ ( ECHO Secure S:\ Drive is NOT mounted or unlocked - aborting! ECHO Secure S:\ Drive is NOT mounted or unlocked - aborting! >> %BACKUPLOG% TIMEOUT /T -1 EXIT ) ECHO Secure S:\ Drive is mounted and unlocked ECHO Secure S:\ Drive is mounted and unlocked >> %BACKUPLOG% ECHO. ECHO Checking if USB P:\ 4TB Primary Backup Drive is connected ECHO Checking if USB P:\ 4TB Primary Backup Drive is connected >> %BACKUPLOG% :CHECKPRIMARY ECHO. IF EXIST P:\ GOTO DOBACKUP MyChoice "USB P:\ 4TB Primary Backup Drive is NOT connected. Try again" "YN" N IF %ERRORLEVEL%==1 GOTO CHECKPRIMARY ECHO Aborting backup ECHO Aborting backup >> %BACKUPLOG% pause EXIT REM REM Starting Backup REM :DOBACKUP ECHO USB P:\ 4TB Primary Backup Drive is connected ECHO USB P:\ 4TB Primary Backup Drive is connected >> %BACKUPLOG% ECHO. ECHO Starting Acronis Backup Script %BACKUPNAME% (Check status in taskbar) ECHO Starting Acronis Backup Script %BACKUPNAME% >> %BACKUPLOG% ECHO. "C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe" /script:"%BACKUPSCRIPT%" if %ERRORLEVEL% NEQ 0 ( ECHO. ECHO Acronis Backup FAILED. Aborting. ECHO Acronis Backup FAILED. Aborting. >> %BACKUPLOG% msg %username% Backup failed... EXIT 1 ) ELSE ( ECHO Acronis Backup completed without any errors ECHO Acronis Backup completed without any errors >> %BACKUPLOG% ECHO. ) REM REM Checking if 2TB Secondary Backup Drive is connected REM ECHO Checking if USB I:\ 2TB Secondary Backup Drive is connected ECHO Checking if USB I:\ 2TB Secondary Backup Drive is connected >> %BACKUPLOG% ECHO. IF NOT EXIST I:\ ( ECHO USB I:\ 2TB Secondary Backup Drive is NOT connected - skipping robocopy ECHO USB I:\ 2TB Secondary Backup Drive is NOT connected - skipping robocopy >> %BACKUPLOG% ) ELSE ( ECHO I:\ 2TB Secondary Backup Drive is connected - starting robocopy ECHO I:\ 2TB Secondary Backup Drive is connected - starting robocopy >> %BACKUPLOG% ECHO. robocopy "P:\Acronis Backup" "I:\Acronis Backup" %BACKUPNAME%_inc*.* /NP /LOG+:%BACKUPLOG% ECHO. ECHO robocopy done. Adding USB I:\ 2TB Secondary Backup Drive bytes free to log ECHO robocopy done. Adding USB I:\ 2TB Secondary Backup Drive bytes free to log >> %BACKUPLOG% dir "I:\Acronis Backup\*.*" | grep "bytes free" dir "I:\Acronis Backup\*.*" | grep "bytes free" >> %BACKUPLOG% ) ECHO Computer Backup Script %BACKUPNAME% completed on %date% %time% ECHO Computer Backup Script %BACKUPNAME% completed on %date% %time% >> %BACKUPLOG% IF /I "%1" EQU "SHUTDOWN" ( REM REM Shutdown Computer REM ECHO. ECHO Shutdown requested. Shutting down computer in 2 minutes. ECHO Shutdown requested. Shutting down computer in 2 minutes. >> %BACKUPLOG% shutdown /s /t 120 ECHO. REM REM command line argument for the choice command /C "A" Only one choice A or a, /M Message REM choice /C "A" /M "To abort shutdown press " if errorlevel 1 shutdown /a ) ECHO Done ECHO Done >> %BACKUPLOG% pause