PowerShell script exchange
Post Reply
GabesVirtualWorld
Expert
Posts: 244
Liked: 37 times
Joined: Jun 15, 2009 10:49 am
Full Name: Gabrie van Zanten
Contact:

Switching running failover to permanent

Post by GabesVirtualWorld »

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?
tsightler
VP, Product Management
Posts: 6009
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Switching running failover to permanent

Post by tsightler » 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"
GabesVirtualWorld
Expert
Posts: 244
Liked: 37 times
Joined: Jun 15, 2009 10:49 am
Full Name: Gabrie van Zanten
Contact:

Re: Switching running failover to permanent

Post by GabesVirtualWorld »

Thank you !!!!
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests