cancel
Showing results for 
Search instead for 
Did you mean: 

Pre/Post BEMCLI Commands

pb_matt
Level 2

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

7 REPLIES 7

pkh
Moderator
Moderator
   VIP    Certified

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

Hi @pkh,

I've tried that also to no avail. Doesn't seem to be working.

Thanks

pkh
Moderator
Moderator
   VIP    Certified

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?

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

pkh
Moderator
Moderator
   VIP    Certified

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.

pb_matt
Level 2

Hi @pkh

Works when I'm using Powershell fine, does not work when I try and run the script from Veritas...

Thanks

pkh
Moderator
Moderator
   VIP    Certified

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.