PowerShell script exchange
Post Reply
Backerupper
Enthusiast
Posts: 47
Liked: 24 times
Joined: Dec 28, 2012 2:32 pm
Contact:

My Veeam Report v9.0.1

Post by Backerupper » 2 people like this post

The latest My Veeam Report for VBR v9 has been released

http://blog.smasterson.com/2016/02/16/v ... rt-v9-0-1/

Highlights include:
  • VBR v9 support
    Simplified repository info gathering
    Updated Get-VMsBackupStatus to remove obsolete cmdlet warning
    Ability to run from system with 'console only' install
Big thanks to tsightler for all his help as well as to Veeam for adding the total/free space properties to the repository info!
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: My Veeam Report v9.0.1

Post by tsightler »

I really like this report. In looking for optimizations I noticed that you already have a nice variable that contains all backup sessions so it would be possible to get rid of the additional call to Get-VBRBackupSession in the Get-VMsBackupStatus function, just replace:

Code: Select all

$vbrtasksessions = (Get-VBRBackupSession | 
    Where-Object {$_.JobType -eq "Backup" -and $_.EndTime -ge (Get-Date).addhours(-$script:HourstoCheck)}) |
    Get-VBRTaskSession | Where-Object {$_.Status -ne "Failed"}
With

Code: Select all

$vbrtasksessions = $allSesh | 
    Where-Object {$_.JobType -eq "Backup" -and $_.EndTime -ge (Get-Date).addhours(-$script:HourstoCheck)} |
    Get-VBRTaskSession | Where-Object {$_.Status -ne "Failed"}
Because the call to Get-VBRBackupSession is one of the heaviest, this can cut the run time significantly. It was a >20% reduction in run time (48 seconds reduced to 37 seconds) just in my lab. I imagine it could save even more in larger environments.

As just a generic comment, as the original author of the VM status function, I think it would be a good idea revisit it and improve this logic a little more as this could easily miss jobs that are still running and have backed up some VMs but not others. Right now if a job is actively running the status of all VMs in that job are ignored. I think it would probably be better to grab all backup sessions from perhaps 2x the SLA, then get only tasks sessions that have both started and ended within the SLA without failed status. That should give a far more accurate result.

This would be an easy change to make and wouldn't add any additional processing time, just some simple changes to the filters. What do you think?
Backerupper
Enthusiast
Posts: 47
Liked: 24 times
Joined: Dec 28, 2012 2:32 pm
Contact:

Re: My Veeam Report v9.0.1

Post by Backerupper »

How about something like this?

Code: Select all

$vbrtasksessions = $script:allSesh | 
        Where-Object {($_.JobType -eq "Backup") -and
($_.EndTime -ge (Get-Date).addhours(-$script:HourstoCheck) -or $_.State -eq "Working")} |
        Get-VBRTaskSession | Where-Object {$_.Status -notmatch "Failed|InProgress|Pending"}
Pat490
Expert
Posts: 170
Liked: 29 times
Joined: Apr 28, 2015 7:18 am
Full Name: Patrick
Location: Germany
Contact:

Re: My Veeam Report v9.0.1

Post by Pat490 » 1 person likes this post

Very nice script. I just tried it for the first time. Works great!
the_mentor
Enthusiast
Posts: 48
Liked: 8 times
Joined: Jul 26, 2012 11:10 pm
Full Name: DeMentor
Contact:

Re: My Veeam Report v9.0.1

Post by the_mentor »

you probably want to change the first line error action from

Code: Select all

Add-PSSnapin "VeeamPSSnapIn" -ErrorAction SilentlyContinue
to

Code: Select all

Add-PSSnapin "VeeamPSSnapIn" -ErrorAction Stop
Since if the addon doesnt load the script cant do anything and other things inside the script will break.

just my 2 cents.
-DeMentor
SebastiaanTempels
Lurker
Posts: 2
Liked: never
Joined: Feb 08, 2016 1:59 pm
Contact:

Re: My Veeam Report v9.0.1

Post by SebastiaanTempels »

No repository details for scale-out repositories?
Can reporting on backup copy jobs also be included?
another_robert
Novice
Posts: 3
Liked: never
Joined: Oct 18, 2016 8:04 pm
Full Name: Robert Another
Contact:

Re: My Veeam Report v9.0.1

Post by another_robert »

I concur if just a small area for backup copy that would be so sweet. I was shoved into the PS of veeam so to get out of this hole I just need that part. :wink:
Backerupper
Enthusiast
Posts: 47
Liked: 24 times
Joined: Dec 28, 2012 2:32 pm
Contact:

Re: My Veeam Report v9.0.1

Post by Backerupper » 1 person likes this post

A whole slew of new stuff in the works

Scale-out repositories
Replication Jobs
Backup Copy Jobs (giving me fits at the moment)
SureBackup Jobs
Task level details for all jobs (per VM)

Stay tuned!
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 21 guests