I recently upgraded to Version 8 from Version 7 of Backup & Replication. My scripts have worked fine for several years. Since the upgrade, my post-job scripts are failing. I added some logging and figured out that the Veeam was returning an incorrect value during the GetLastResult() portion of the script below. If I execute the script manually (as the same user that runs the Veeam Backup Service), I get the proper result of either, "Success," "Warning" or "Failed." When Veeam calls the script, it returns "None"
The solution was two parts. Part 1 is to have Veeam call a batch file that calls the Powershell script with the "start" command so the batch file can finish executing and close.
Then, in the Powershell script, I needed to add a while loop to check for the "IsRunning" property. This should allow the job to finish up, get a correct Success/Failed value and allow the rest of my script to execute.
Ok, I must have forgotten that now scripts are considered to be a part of job session, so, the result of it is not updated, till post-job activity script finishes. The batch file with start command executing PS script that makes use of IsRunning property is indeed a nice workaround. Thanks for posting!
Indeed, this basically is the same workaround I used when I discovered this change in v8 behavior back of few months ago. Sorry I didn't see this thread sooner, could have perhaps saved you some time, but thanks very much for sharing with the community.