we would like to externally schedule and start one of our Veeam Jobs using a solution called Automic Automation Engine (formerly known as UC4). In order for this to work, I guess I just need a PowerShell script for starting the job whose execution is scheduled and triggered by the remote software. However, the plan is not just to schedule and start the job but also to find out whether it was successful and if yes to execute another script which performs some additional tasks within the machine that was backed up. So basically:
1. Remote software executes script which starts the backup job
2. If job was successful, the remote software executes another script, if not it generates a warning message
I don't have much to do with scripting and I currently don't have an understanding about how the remote software can find out whether the backup job was successful or not. I understand that a script can handover an "exit code" to inform whether it ran successfully or not. In case the remote software uses that "exit code" to determine the status - will an exit code of success (i.e. 0) mean that the backup ran successfully (or at least finished, be it successful or not) or does it just mean that the script successfully completed and started the backup job? If an exit code of success means that the backup was successful (or finished) I guess the execution of the scripts lasts until the backup completes and not only for time needed to start the job?
Is the exit code always available after a PowerShell script completes? For instance, if using just a one-lined script to start the backup job like this:
- Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
Is the exit code available without adding additional code to the script so it can be used by the remote software to determine whether the execution of the script (or completion of backup) was successful or not?
Sorry for asking so many questions which might seem a little dumb but as said above, usually I don't have anything to do with scripting.