Switching running failover to permanent

PowerShell script exchange

Switching running failover to permanent

Veeam Logoby GabesVirtualWorld » Sat Jan 14, 2017 11:26 am

Hi
We're using VEEAM Replication jobs to move a customer into our datacenter. We have a long list of VMs to move and when the customer says VMxxx is ready, we do a planned failover of the VM.

For this I created a simple script:

Code: Select all
$VMFailover = read-host "For which VM to do a planned failover?"
$VMFound = Get-VBRRestorePoint -Name $VMFailover | Sort-Object $_.creationtime -Descending | Select -First 1
$Continue = Read-host "(YES/NO) Continue with " $vmfound.vmname " Last sync: " $vmfound.CreationTime
If( $Continue = "YES")
{
   Get-VBRRestorePoint -Name $VMFailover | Sort-Object $_.creationtime -Descending | Select -First 1 | Start-VBRViReplicaFailover -Reason "Batch 2" -RunAsync -Planned -Confirm
}


After the failover, the customer will do the checks to see if the application is running fine and after that, I need to make the running failover permanent. I can't find a powershell command for this. In the docs I can find a way to immediately do a permanent failover, but not to make a running failover permanent. I'm not sure what the "-definite" option would do if I run this:
Code: Select all
 Start-VBRViReplicaFailover -Reason "Batch 2" -RunAsync -Definite-Confirm


Any tips?
GabesVirtualWorld
Service Provider
 
Posts: 140
Liked: 10 times
Joined: Mon Jun 15, 2009 10:49 am
Full Name: Gabrie van Zanten

Re: Switching running failover to permanent

Veeam Logoby tsightler » Sat Jan 14, 2017 3:40 pm 1 person likes this post

You are on the right track, you simple run the "Start-VBRViReplicaFailover" cmdlet again with "-Definite". Here is a sample of a script I provide to customers as a starting point when they want to script failover:

Code: Select all
asnp VeeamPSSnapin

$Job = "Replicate Exchange"
$VMName = "exch01"
$RP = Get-VBRReplica -Name $Job | Get-VBRRestorePoint -Name $VMName | sort CreationTime -Descending | Select -First 1

$FailoverSession = Start-VBRViReplicaFailover -RestorePoint $RP -Confirm:$false -RunAsync
write-host -NoNewLine "Failover Job is running..."
Do {
wait-event -timeout 10
write-host -NoNewLine "."
$SessionStatus = Get-VBRRestoreSession | ?{$_.Id -eq $FailoverSession.Id}
} Until ($SessionStatus.IsCompleted -eq $True)
write-host "...Failover Job completed"

#
$PermFailoverSession = Start-VBRViReplicaFailover -RestorePoint $RP -Confirm:$false -RunAsync -Definite
write-host -NoNewLine "Permanent Failover Job is running..."
Do {
wait-event -timeout 10
write-host -NoNewLine "."
$SessionStatus = Get-VBRRestoreSession | ?{$_.Id -eq $PermFailoverSession.Id}
} Until ($SessionStatus.IsCompleted -eq $True)
write-host "...Permanent Failover Job completed"
tsightler
Veeam Software
 
Posts: 4768
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Switching running failover to permanent

Veeam Logoby GabesVirtualWorld » Sat Jan 14, 2017 3:48 pm

Thank you !!!!
GabesVirtualWorld
Service Provider
 
Posts: 140
Liked: 10 times
Joined: Mon Jun 15, 2009 10:49 am
Full Name: Gabrie van Zanten


Return to PowerShell



Who is online

Users browsing this forum: Google [Bot] and 5 guests