Quickly get last Veeam backup time of all VMs from vCenter

PowerShell script exchange

Quickly get last Veeam backup time of all VMs from vCenter

Veeam Logoby jgrote » Wed Mar 01, 2017 8:24 pm 2 people like this post

Hello,

This assumes you're using the option in Veeam jobs to add a note to the VM with the last backup status.

Code: Select all
$VMwareNoteProperyName = "VeeamBackupStatus"
get-vm | get-annotation -name "VeeamBackupStatus" | select annotatedentity, @{n="LastBackupTime";e={[Datetime]($_.value -replace '.*Time: \[(.*?)\].*','$1')}}


Super useful if you want to get an idea of backup coverage across a customer environment in an MSP scenario like mine. Just cooked it up and thought I'd share.

Taking it further, get all snapshots from powered on VMs that are older than 7 days and also report their last backup time:
Code: Select all
$days =7
$datacenter = "my datacenter"
get-datacenter $datacenter | get-vm | where powerstate -match 'PoweredOn' | get-snapshot | where created -lt (get-date).adddays(-$days) | select VM,Name,Description,created,sizeGB,@{n="VMLastBackedUp";e={[DateTime]((get-vm $_.vm | get-annotation -name VeeamBackupStatus) -replace '.*Time: \[(.*?)\].*','$1')}} | sort created | export-csv -NoTypeInformation "$home\desktop\VMSnapshotsOlderThan${Days}DaysReport-$(get-date -format yyyyMMdd).csv"
jgrote
Novice
 
Posts: 8
Liked: 4 times
Joined: Tue Jul 13, 2010 12:14 am
Full Name: Justin Grote

Re: Quickly get last Veeam backup time of all VMs from vCent

Veeam Logoby Vitaliy S. » Thu Mar 02, 2017 11:53 am

Justin, thanks for sharing! Since you're the MSP, can you please tell us what tools do you use to remotely manage your clients' infrastructures? Also I would suggest to join our free VCSP program to get access to all MSP/VCSP related news from Veeam.
Vitaliy S.
Veeam Software
 
Posts: 19770
Liked: 1120 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov


Return to PowerShell



Who is online

Users browsing this forum: robjohnston, Yahoo [Bot] and 5 guests