Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Keg9211
2018-09-04T16:30:19Z
Sorry, new to the forum so please excuse if I am not doing something correctly.
version VC 8.3.5

This is the same for PowerShell as well as .bat files. If the VC remote execute file calls another file to set its variables, those variable changes are lost.

Main.Bat has this: call C:\folder\SetEnv.cmd
None of the variables in SetEnv.cmd are retained for other lines in main.bat.

If I run the main.bat file at the command line or in TaskScheduler, then the main bat file retains the variables inside SetEnv.cmd. So this seems to be some sort of scope issue with Remote Execute??? Is there a flag or way to tell it to keep the variables?

Thanks.
Sponsor
Forum information
Support
2018-09-14T14:52:19Z
Sorry for the late reply.

VisualCron Variables can only be replaced on VisualCron Server machine. You could pass an argument in the Remote Execute Task and pass a value that way (if you capture it in your script).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Keg9211
2018-09-14T15:18:28Z
Thank you for the reply. :)

This isn't VC variables but script variables scope issue. Let me give a little more info to clarify.

The application configuration tool maintains a file called ENV.bat which contains the variables like JAVA path, Weblogic home, etc. This changes per environment and with each patch. The application service reads this file to start the application correctly. So this ENV.bat would be cumbersome to hard code into a VC job.

I would like for VC to call a bat or powershell file on the server, say RUNTHIS.bat. Inside RUNTHIS.bat (which would be the same on all of my application servers), it does a call to ENV.bat to set its environment before running its tasks (say restart the application). In a bat file that is just a one line of "call ENV.bat".

So RUNTHIS.bat looks something like:
call ENV.bat
%APP_HIOME%\startprocess.exe

If I run RUNTHIS.bat on the server using cmd, the environment variables from ENV.bat are read in and the startprocess,exe has no issues running correctly.

However... in VisualCron it does not honor the call to the ENV.bat... There are no errors but the variables set in ENV.bat are lost before the next line of the RUNTHIS.bat executes. The same is true calling a remote Powershell job that does a ". ENV.ps" type of call to pull in variables from another powershell. Something is off with the variable scope in VisualCron which prevents the normal windows scope. Maybe there is a setting or flag that I can use?



Support
2018-09-14T15:23:46Z
Originally Posted by: Keg9211 

Thank you for the reply. :)

This isn't VC variables but script variables scope issue. Let me give a little more info to clarify.

The application configuration tool maintains a file called ENV.bat which contains the variables like JAVA path, Weblogic home, etc. This changes per environment and with each patch. The application service reads this file to start the application correctly. So this ENV.bat would be cumbersome to hard code into a VC job.

I would like for VC to call a bat or powershell file on the server, say RUNTHIS.bat. Inside RUNTHIS.bat (which would be the same on all of my application servers), it does a call to ENV.bat to set its environment before running its tasks (say restart the application). In a bat file that is just a one line of "call ENV.bat".

So RUNTHIS.bat looks something like:
call ENV.bat
%APP_HIOME%\startprocess.exe

If I run RUNTHIS.bat on the server using cmd, the environment variables from ENV.bat are read in and the startprocess,exe has no issues running correctly.

However... in VisualCron it does not honor the call to the ENV.bat... There are no errors but the variables set in ENV.bat are lost before the next line of the RUNTHIS.bat executes. The same is true calling a remote Powershell job that does a ". ENV.ps" type of call to pull in variables from another powershell. Something is off with the variable scope in VisualCron which prevents the normal windows scope. Maybe there is a setting or flag that I can use?





I think it might not find the ENV.bat. I would try to hard code the full path or integrate it in the same script - at least for testing.


Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top