View Only
  • 1.  SRM Environment variables in scripts

    Posted Mar 15, 2019 02:26 PM

    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.


  • 2.  RE: SRM Environment variables in scripts
    Best Answer

    Posted Mar 15, 2019 02:53 PM

    Very limited BAT/CMD knowledge here, but shouldn't that be

    If "%VMware_RecoveryMode%" == "test"

  • 3.  RE: SRM Environment variables in scripts

    Posted Mar 18, 2019 02:36 PM

    thanks a lot that worked.