Question

Pre/Post Script definition

  • 15 April 2024
  • 1 reply
  • 20 views

Userlevel 2
Badge +9

Hi Team,

 

I saved it as "Save as Script" and Synchronous for 2 separate Windows subclient via Commvault.
Let's call them 1.bat and 2.bat.
I also created a main.bat and made its content as follows.
call 1.bat
call 2.bat

I added Main.bat to the Pre Scan phase in another Windows subclient from the Commvault Console as "C:\CVScript\main.bat".

Our expectation was this: main.bat will be triggered by Commvault and first the 1st bat will run, the backup will be completed and then the 2nd bat will run and the backup will be completed. After this, the Pre Scan phase will be completed.
Currently, the Pre Scan phase is running, main.bat is running and is completed in 3 seconds, but the 1st and 2nd bats in its content cannot be run. It actually needs to run for about 9 hours.

When I manually trigger Main.bat, it works as expected.

Does anyone have an idea ?


1 reply

Userlevel 2
Badge +4

Since Scripts run in administrator mode so that means they open up in c:\Windows\System32, similar to opening up command prompt as an administrator. Therefor the script should include a path to the 1.bat and 2.bat files otherwise it’s calling them from inside the c:\Windows\System32, which they don’t exist. 

When running the script manually from the CVSCript folder, the prompt is already in that folder so the files execute. 

An easy fix is to set the directory in the begining:

CD C:\CVScript\

call 1.bat
call 2.bat

 

Keep us posted on how it goes

Reply