Rashida11
Contributor
Contributor

VM failover script between two datacenter

Jump to solution

http://communities.vmware.com/docs/DOC-7470

I stumbled accross this link and will be looking into it today...Just wondered if anone has had a play with this yet

As we cannot afford to purchase SRM... this look like the way forward !!!!!!

0 Kudos
1 Solution

Accepted Solutions
gboskin
Enthusiast
Enthusiast

Sorted ..Simple failover script taking into consideration Vmx have been created on the DR side.

Regards

View solution in original post

0 Kudos
3 Replies
gboskin
Enthusiast
Enthusiast

I have taken a hint from the link and wirtten mine ( Not right yet )

In my evnvironment there is need to failover all the Vms running in a resource pool . So The Resource pool is the same on both datacenter .. so This it is he only parameter that needs to be passed

The script should

1) get and shutdown all the VMs on the source datacenter cluster

2) pause and wait for you to type "CONTINUE" ( You then go and do the SAN failover side)

3) Type continue and resan all hosts on cluster2

4) Start all vm in cluster2...&respource pool

Note in my environmnet all the vmx and resource have all ready been created @ the DR side....

As I said am still working on it ..as I am not yet a powershell GURU

0 Kudos
gboskin
Enthusiast
Enthusiast

I have re-written this simple script

  1. Add VI-toolkit #

##################

Add-PSsnapin VMware.VimAutomation.Core

Initialize-VIToolkitEnvironment.ps1

*

connect-VIServer $vcserver

*

################################################################################

  1. get List of Vm to failover and Shutdown

################################################################################

$vms = Get-Cluster -Name $cluster1 | Get-ResourcePool -Name $pool | Get-VM | Shutdown-VMGuest

################################################################################

  1. Pause and wait for user input to continue.

################################################################################

#???????????????

################################################################################

  1. Rescan target hosts storage

################################################################################

$ScanHost = Get-Cluster -name $cluster2 | Get-VMHost | Get-VMHostStorage -RescanAllHBA

################################################################################

#Start Target Virtual Machine

################################################################################

$vmstart = Get-Cluster -Name $cluster2 | Get-ResourcePool -Name $pool | Get-VM | Start-VM

##############################

  1. Disconnect session from VC #

##############################

*

disconnect-viserver -confirm:$false

I just need to add code to get it to pause and wait for user input

*

0 Kudos
gboskin
Enthusiast
Enthusiast

Sorted ..Simple failover script taking into consideration Vmx have been created on the DR side.

Regards

View solution in original post

0 Kudos