PowerShell script exchange
Post Reply
jgrote
Influencer
Posts: 13
Liked: 4 times
Joined: Jul 13, 2010 12:14 am
Full Name: Justin Grote
Contact:

Quickly get last Veeam backup time of all VMs from vCenter

Post by jgrote » 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" 
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

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

Post by Vitaliy S. »

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.
Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 13 guests