Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

eptesicus

Sync script running from Veeam backup job - Permission issues

I have the batch script below set to run from Veeam B&R after a backup job runs. Veeam services on the server are ran as the user, Local System.

If I run the script manually from my normal user account, it works successfully. If I right click, run as another user, and chose run the script as the user account I'm logged in as, or run it as admin, or run it under Local System, I get the error below (System Error. Code: 3.)

Thoughts on how to get the script to work to run from Veeam following the backup job and/or be able to run the script successfully from other accounts?

@echo off
 
Set DateTime=%date:~10%-%date:~4,2%-%date:~7,2%_%time:~0,2%.%time:~3,2%.%time:~6,2%
REM echo %DateTime%
 
Set SourcePath=V:\Critical-Offsite
Set DestinationPath=/Veeam/Critical-Offsite
 
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\SFTP\logs\Veeam.Critical.Offsite.SFTP_%DateTime%.log" /ini=nul ^
  /command ^
    "open ftps://user:pass@site.com/ -certificate=""xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""" ^
    "synchronize remote -delete %SourcePath% %DestinationPath%" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%