Listing replicated VMs

PowerShell script exchange

Listing replicated VMs

Veeam Logoby marius roma » Sun Jan 08, 2017 11:04 am

I need to have a list of replicated VMs with the date of the latest successfull replica.
Replicas folder provides a list of replicated VMs but the date looks to be the date of the first replica, not the latest.
I need to see the current state of replicated VMs in order to say if a replica is current or not.
Can I get such list from Veeam B&R console or should I use PowerShell or any other tool?
Regards
marius
marius roma
Expert
 
Posts: 317
Liked: 3 times
Joined: Wed Feb 01, 2012 12:04 pm
Full Name: Mario

Re: Listing replicated VMs

Veeam Logoby Vitaliy S. » Sun Jan 08, 2017 12:14 pm

Hi Marius,

You can either try to create such report with PowerShell or just generate one of these predefined reports in Veeam ONE:
1. Protected VMs
2. Latest Backup Job Status
3. VM Backup Status

Thanks!
Vitaliy S.
Veeam Software
 
Posts: 19545
Liked: 1099 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Listing replicated VMs

Veeam Logoby pcarpenter » Tue Jan 17, 2017 9:58 pm

This should get you started. You can build a hash table and output this information however you'd like:

Code: Select all
$ReplicaSessions = (Get-VBRBackupSession | ? {$_.JobType -like "Replica"} | Get-VbrTaskSession
[array]$VMs = $ReplicaSessions.Name

Foreach ($Vm in $VMs) {
$VmReplicaSessions = $ReplicaSessions | ? {$_.Name -like $Vm}
$RecentReplicaSession = $VmReplicaSessions | Sort-Object { $_.Info.QueuedTime } | Select -Last 1
$JobName = RecentReplicaSession.JobName

$ReplicaPoints = Get-VBRReplica -Name $JobName | Get-VBRRestorePoint
$VmReplicaPoints = $ReplicaPoints | ? {$_.Name -like $Vm }
$VmReplicaPoints = $VmReplicaPoints | Sort-Object {$_.CreationTime};
$RecentReplica = $VmReplicaPoints | ? {$_.IsConsistent -like "True"} | Select -Last 1;
[int32]$ReplicaAge = (New-TimeSpan -Start $RecentReplica.CreationTime -End (Get-Date) ).TotalHours
Write-Host "$Vm`, $JobName`, $ReplicaAge"
}

pcarpenter
Service Provider
 
Posts: 1
Liked: never
Joined: Tue Jun 07, 2016 1:35 pm
Full Name: Patrick Carpenter


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests