I got a question today from one of my customers on how to run a script from an SRM Recovery Plan. They tried everything but never got it working. It’s fairly easy, although you would need to take a couple of things in consideration. And reading the SRM Admin Guide page 52 and 53 wouldn’t harm you as well. But then again we’re talking technical people here, who reads the manual? (Besides Mike Laverick aka Mr RTFM of course. Mike, btw, also recently released the third chapter of his SRM book for free, which is most definitely worth reading!!)
I guess the most important things to remember if you want to run commands/batch files from SRM are:
- SRM can only execute .exe or .com files, if you need to run a batch file do the following:
c:\windows\system32\cmd.exe /c c:\yellow-bricks.bat
- Scripts must reside on the host where the SRM server is installed.
- SRM callouts to batch files or commands run as the local administrator of the SRM server host, and not as the user logged into the VI Client.
- A recovery terminates if a command or script exits with a non‐zero status.
- If the script call out takes longer than 300 seconds to complete it will be terminated. You can increase this by changing/adding the following line in vmware-dr.xml with the desired value: