05-29-2017 03:40 AM
I am running a post job from powershell that takes status from last run job.
get-bejob "Backup 00002-full" | Get-BEJobHistory -FromLastJobRun | Get-bejoblog | findstr c:"Media Label:"
When run seperately, it works as expected, but when run as part of the backup job, the output is empty. I guess than this is because the backup job is actually running until the postjob has run therefor producing an empty output.
How to solve this?
05-30-2017 01:58 AM
Whilst the job history is written to during the job, the job log is the last action the job does (after the post command and the job log actual states whether or not the post command ran
If you get clever with batch commands you might be able to Use BE to call a first batch file. Have that batch file call a second but using the method that allows the first batch comand to finish without waiting for the second to finish
Have the second batch command contain a wait for so many minutes command (to get beyond the job log saving time) and then run your a power shell script (with the Import-Module command as well - to do what you want