VMware Cloud Community

SRM Envrionmental Variables in Scripting.

I am having issues running the SRM environment variables such as :

VMware_RecoveryMode and VMware_VC_Host.

I want to know how to apply these to scripts like in a if and else statements.

So if i pass the variable via echo and run it in a step in a recovery plan it works so the script is called testrun :

echo %VMware_RecoveryMode% >> D:\scripts\MES\logs\logfile.log 

and so when i add a step in the recovery step to the location of this script like :

C:\Windows\System32\cmd.exe /c d:\scripts\MES\Testrun.bat

It runs fine when i run a test as it outputs test in the log fils.

But now when i run this variable in a script with the if and else statements when doing a test recovery it does not work.  So an example of the script is :

If "%VMware_RecoveryMode%==test"

echo %VMware_RecoveryMode% >> D:\scripts\MES\logs\logfile.log

This fails in a recovery plan.   I have tried various combinations of if syntax with quotation marks, brackets, and then commands, but it keeps failing.

Has anyone used these variables in scripts and made it to work, can anyone send a sample of a working script.


0 Kudos
0 Replies