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:
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:
Thank you for any assistance!
Mike...
Nobody? Anybody? Hello, Tap-Tap-Tap is this thing on?
Have you looked at this post? https://blogs.vmware.com/vsphere/2011/07/srm-5-and-scripts.html
1. At a cursory glance, yes. Have you tested it?
2. The connect step, definitely. The initialize step, I'm not sure. I recommend testing it
3. You will need to run it manually. You can't insert steps into cleanup.
