PowerShell script exchange
Post Reply
Manfriday
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 15, 2009 6:03 pm
Full Name: Jason Morris
Contact:

Get backup status for individual VM's

Post by Manfriday »

Hi,

Some of the admin's want to be able to pull a list of the individual VM's backup status.
They don't want to dig thru the job reports.. they just want to be able to run a script and find out whether a specified VM was backed up properly or not.

Is there a way to do this with powershell?
Vitaliy S.
VP, Product Management
Posts: 27368
Liked: 2799 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Get backup status for individual VM's

Post by Vitaliy S. »

Hi Jason,

You may want to take a look at this existing post, that has a script example that you're looking for:
PowerShell Veeam backup status report

Thanks!
Manfriday
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 15, 2009 6:03 pm
Full Name: Jason Morris
Contact:

Re: Get backup status for individual VM's

Post by Manfriday »

Thanks!

I had seen that thread actually, but the script doesn't seem to work with version 6.


Jason
Sethbartlett
Veteran
Posts: 282
Liked: 26 times
Joined: Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett
Contact:

Re: Get backup status for individual VM's

Post by Sethbartlett » 1 person likes this post

Code: Select all

$VMName = "Name of your VM"
foreach($Job in (Get-VBRJob))
{
	$Session = $Job.FindLastSession()
	if(!$Session){continue;}
	$Tasks = $Session.GetTaskSessions()
	$Tasks | ?{$_.Name -eq $VMName} | %{write-host $_.Name ":" $_.Status}
}
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Manfriday
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 15, 2009 6:03 pm
Full Name: Jason Morris
Contact:

Re: Get backup status for individual VM's

Post by Manfriday »

That worked great!
Thanks!
robudus
Lurker
Posts: 1
Liked: never
Joined: Oct 27, 2021 12:43 pm
Full Name: Robert
Contact:

Re: Get backup status for individual VM's

Post by robudus »

Hi we use Veeam B&R 11.

i tried:

Code: Select all

$VMName = "Name of your VM"
foreach($Job in (Get-VBRJob))
{
	$Session = $Job.FindLastSession()
	if(!$Session){continue;}
	$Tasks = $Session.GetTaskSessions()
	$Tasks | ?{$_.Name -eq $VMName} | %{write-host $_.Name ":" $_.Status}
}
I get this error: Method invocation failed because [Veeam.Backup.PowerShell.Infos.VBRComputerBackupJob] does not contain a method named 'FindLastSession'.


I would like to get the backup status from one vm or real machine. Please help.

Thx
ROBudus
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get backup status for individual VM's

Post by oleg.feoktistov »

Hi Robert,

Do you use Get-VBRComputerBackupJob cmdlet for agent backup jobs anywhere in your script?
This error basically means that the object returned with Get-VBRComputerBackupJob doesn't have FindLastSession() method.
To get last session for agent backup jobs you would need to use native powershell filtering capabilities:

Code: Select all

$job = Get-VBRComputerBackupJob -Name 'Job Name'
$sessions = Get-VBRComputerBackupJobSession -Name $($job.Name) | Sort -Property CreationTime
$sessions | Select -First 1

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: Baidu [Spider], jdb and 18 guests