VMware Cloud Community
MMRNOLA
Contributor
Contributor

Question about "Post Power On Step"

We've implemented a script on each guest that runs during a recovery step (Post Power On Step). I would like to know if it would be possible to call a different script on the failback to the protected site? We have 2 different scripts, one for recovery to recovery site, one for recovery to protected site.

SRM = 5.1

Any help is appreciated!

0 Kudos
6 Replies
MMRNOLA
Contributor
Contributor

after reading some more, this "might" work.

Can anyone confirm or not if the "Recovery VC host" changes according to SRM when failed over to the protected site? In other words, do the roles (Recovery and Protected) change when you are recovered and protected at the original recovery site? 

If%VMware_VC_Host%==ausutil2.fmi.com goto script A

If%VMware_VC_Host%==nlautil5.fmi.com goto script B

:script A

c:\Scripts\A.bat

goto :eof

:script B

c:\Scripts\B.bat

goto :eof

0 Kudos
mal_michael
Commander
Commander

Hi,

Have you figured the answer already? I am curious to know.

If not, I will try to find out myself.

Michael.

0 Kudos
MMRNOLA
Contributor
Contributor

i'm working on this theory now.

It doesn't look like it's working. Meaning that the VC Recovery server name isn't dynamic. I'm running through another test and will view the logs and update what I find.

0 Kudos
MMRNOLA
Contributor
Contributor

Solution. The IP addresses in this script are for the SRM IPs. When doing a Recovery, the first IP will the be Protected site's, the second IP in the script will be the Recovery site's SRM IP.

Let me know if you need an explanation on this.

IPCONFIG > ip.txt
FIND "10.10.10.10" ip.txt
IF ERRORLEVEL 2 GOTO PROBLEM
IF ERRORLEVEL 1 GOTO :NEXT

IF ERRORLEVEL 0 GOTO A_B

:PROBLEM
ECHO    A Problem with "FIND" Has Occurred
ECHO     Error with IPFIND
GOTO VERYEND
:A_B

c:\Scripts\test\A_B.bat
GOTO VERYEND
:NEXT

FIND "10.10.10.11" ip.txt
IF ERRORLEVEL 2 GOTO PROBLEM
IF ERRORLEVEL 1 GOTO VERYEND
IF ERRORLEVEL 0 GOTO B_A

:B_A
c:\Scripts\test\B_A.bat
GOTO VERYEND
:VERYEND
DEL ip.txt

0 Kudos
mal_michael
Commander
Commander

Nice workaround.

What I was curious about is specifically %VMware_VC_Host% variable thing.

Thanks anyway for the update.

Michael.

0 Kudos
MMRNOLA
Contributor
Contributor

I take my previous comments back. When looking through the logs, I can see where the VMware_VC_Host value does change, but this depends on what VC host you execute the recovery from and the state of your SRM failover. Once you failover, you will execute the recovery in reverse but from the original Protected site's SRM server. So at this point, the value does change.

More testing to get this working. And testing takes SOOOOOOOO long..:smileycry:

0 Kudos