10-07-2023 01:12 PM - edited 10-07-2023 01:27 PM
I'm trying to chain jobs using BEMCLI. In the post command, I'm inputting powershell Start-BEJob -In "Job2" -Confirm:$False | Wait-BEJob but I can't get it to run properly.
Has anyone had any recent experience with trying to set this up?
Thanks
10-08-2023 07:00 PM
Did you input the following in your post-command?
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe Start-BEJob -In '"Job2"' -Confirm:$False
You might want to read an old article of mine below on various ways to chain your jobs
https://vox.veritas.com/t5/Articles/Use-BEMCLI-to-chain-jobs/ta-p/810487
10-09-2023 01:07 AM
10-09-2023 02:28 AM
https://vox.veritas.com/t5/Articles/Preparing-your-Powershell-environment-to-run-BEMCLI-and-scripts/...
Did you do the steps in my article above to prepare your powershell environment to run BEMCLI?
10-09-2023 03:15 AM
Hi @pkh,
I have followed the guide as well. We're running Server 2022 so step 1 is not required. Execution policy is set and appears as below:
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Unrestricted
LocalMachine RemoteSigned
The module has been imported from \program files\veritas\backup exec\modules\bemcli\bemcli and c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe Start-BEJob -In '"Job2"' -Confirm:$False is set as a post command after the job, "Job1" in this case.
Job history shows "Starting Post Job Command < c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe Start-BEJob -In '"Job2"' -Confirm:$False >" so it should be working in theory.
Do you have any more advice?
Thanks
10-09-2023 03:29 AM
Did you import the BEMCLI module?
Do a script to
1) import the BEMCLI module
2) start the job.
Put some write statements to trace its execution.
Execute this script in your job rather than the start job.
10-11-2023 09:00 AM
Hi @pkh
Works when I'm using Powershell fine, does not work when I try and run the script from Veritas...
Thanks
10-11-2023 05:38 PM
This is because the BE job that is running the post command is in a different environment and the BEMCLI module is not imported into that environment. Either do as I suggest in my article to update the profile or execute a script with the import instead.