Powershell - Creating a Backup Report

PowerShell script exchange

Retrieve VMs in jobs with Powershell

Veeam Logoby odruard » Sat May 14, 2011 5:33 pm

[merged into existing discussion]

Hello all

I'm looking for a way to retrieve all VMs backed up in a job.

Such a command retrieve the objects in a job :
Code: Select all
ForEach ($Job in Get-VBRJob) { $Job.GetObjectsInJob() | ForEach { $_.Location } }

However, for organizational reasons, we don't add VMs directly in jobs.
Jobs are configured to back up folders (the folders you can see in "VMs and Templates" view from vSphere Client).
Then jobs are definitely configured, and if we add a VM in the group, this VM will be automatically backed up without any modification in Veeam Backup.

The command line show here upper give only the list of VMs groups.
Same problem should occurs if you back up datastores lists instead of VM lists.

Does anybody knows the way to retrieve the Backup Status for each VM ?

Thanks for your help.
Olivier
odruard
Enthusiast
 
Posts: 29
Liked: never
Joined: Tue Jan 25, 2011 2:12 pm
Full Name: Olivier Druard

Re: Powershell - Creating a Backup Report

Veeam Logoby Vitaliy S. » Sun May 15, 2011 10:23 am

Hi Olivier, try using the script from Yannick on the previous page.

Furthermore, you may also want to look at this script from David - PowerShell script

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

Re: Powershell - Creating a Backup Report

Veeam Logoby odruard » Sun May 15, 2011 3:37 pm

I didn't found these examples. Thanks.

I quiclky tested Yannick's one. I retreive VM's lists.
Need to be adapted to my needs, but seems a good starting point.

I didn't yet tried David's one. Need to be modified first, as I saw it start jobs.

Thanks,

Olivier
odruard
Enthusiast
 
Posts: 29
Liked: never
Joined: Tue Jan 25, 2011 2:12 pm
Full Name: Olivier Druard

Re: Powershell - Creating a Backup Report

Veeam Logoby clix » Tue May 17, 2011 10:21 pm

Great script Yannick, thank you.

I just need to figure out a way to show if a job is disabled/unscheduled as the report will continue to show a backup being successful/failed/warning even though it's not running.

Cheers,

Manuel
clix
Influencer
 
Posts: 13
Liked: never
Joined: Wed Feb 18, 2009 3:40 am

Re: Powershell - Creating a Backup Report

Veeam Logoby ylevadoux » Tue Jun 28, 2011 9:40 am

clix wrote:Great script Yannick, thank you.

I just need to figure out a way to show if a job is disabled/unscheduled as the report will continue to show a backup being successful/failed/warning even though it's not running.

Cheers,

Manuel


Hello,

I would use something like this (Using built-in Veeam Powershell cmd-let) :

$myJob = Get-VBRJob | where {$_.Name -eq "Your Job Name"}

All information regarding scheduling are now located in $myJob.info.ScheduleOptions

More specificly $myJob.info.ScheduleOptions.NextRun is empty if there is no schedule, and it contain a date/time if it is scheduled.
Depending your need, add the job (or not) to the job list to be reported.
ylevadoux
Novice
 
Posts: 8
Liked: never
Joined: Wed Mar 02, 2011 12:16 am
Full Name: Yannick Levadoux

Power Shell to list result of every vm in backup job

Veeam Logoby hermelin » Tue Jul 26, 2011 2:32 pm

[merged]

Hi

We need a power shell script that lists the backup result of every VM in a backup job. We also need to list the date on which the backup was done.

We have tried the following but it only tells us the result of the entire backup job. Not the VMs in the job.
$job = GetVBRJob
foreach($j in $job){$j.findlastsession() | ft -autosize >> c:\temp\backupresult.txt }

/Mattias
hermelin
Lurker
 
Posts: 1
Liked: never
Joined: Tue Jun 21, 2011 12:30 pm
Full Name: Hermelin IT-partner AB

Re: Powershell - Creating a Backup Report

Veeam Logoby Sethbartlett » Wed Jul 27, 2011 12:57 am

You need to do the following:

Code: Select all
$job = Get-VBRBackup | ?{$_.JobName -eq "JobName"}

foreach($v in $job.GetOibs()) { echo $v.VmName $v.IsConsistent}


This will output the name of the VM, the next line will give you true/false on whether the point was consistent. If you start a job and let one VM finish and then stop the job and run this, you will see inconsistent for your other VMs in the job and they will show as "false".
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.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests