Quantcast
Channel: VMware Communities : Discussion List - Site Recovery Manager
Viewing all articles
Browse latest Browse all 3691

SRM Custom Scripts

$
0
0

I have a few questions on setting up SRM to run a custom PowerCLI script during DR execution. Well more of a sanity check.

 

We have SRM configured between the Prod and DR site. In DR we use the hardware for testing so it is not sitting idle. What this means is there are copies of key systems running in the DR site isolated from the production network for doing testing with. They all are prefixed with SC_ in the name so they are easily identified.

 

To run a DR test we need to power down these systems before we bring up the actual recovered systems. We tried to use the Step to suspend VMs in the recovery site but that doesnt power them down, it suspends them. Last test we ran was the first time we tried to use that step. It took over an hour to 'suspend' the boxes. I did a little research and found some code to power down the VMs using PowerCLI. The script works fine when I just run it logged in as me. I have not had a chance to test it using SRM.

 

From what I have read I need to do the following to set this up:

 

  1. Install PowerCLI on the SRM Servers. I actually installed PowerCLI on the 2 SRM servers and the 2 VC servers.
  2. Put the script on the SRM Servers (mine is in C:\Scripts and is called SC_PowerDown.ps1)
  3. Add a step to SRM to call the script using the below syntax.

 

     c:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe  C:\Scripts\SC_PowerDown.ps1

 

This step is inserted as Step 3 in the plan right before the now un-configured 'Suspend' step.

 

SC_PowerDown.ps1 conatins the following code:


."C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"

connect-viserver DR-VC-Server

$vmservers=Get-VM -Name SC_* | Where-Object {$_.powerstate -eq ‘PoweredOn’}

$vmservers | select Name | export-csv c:\Scripts\DR-PWR-Off_Servers.csv -NoTypeInformation

$vmservers | Shutdown-VMGuest -Confirm:$false

 

My main questions are:

 

  1. Does this look like it is configured correctly?
  2. Do I need the first two lines of code to load 'Initalize-PowerCLIEnvironment.ps1' and 'connect-viserver' or does SRM assume that and does it automatically?
  3. I have a script to power the SC_ Systems back on when the test is complete and wanted to insert it into the 'Clean up' steps but I can't edit that. How can I get that in there or do I need to run the power on script by hand once the cleanup process in SRM is complete?

 

Thank you for any assistance!

 

Mike...


Viewing all articles
Browse latest Browse all 3691

Trending Articles