Veeam v9 – My Veeam Report v9.0.3

mvr903

Here we are with another update to My Veeam Report. Boy, has this report come a long ways!

This is quite a large update with many additions that folks have been asking for – hopefully I’ve hit the mark. Instead of a long boring list of what’s new, I’ll highlight the big items. For a full list of changes see the VersionInfo region of the script.

What’s New

Am I Protected?

VM Backup Protection status has earned it’s own summary section. Keeping a close eye on jobs is nice but what if someone forgot to add the latest VM to a backup job? This area looks at your entire VMware infrastructure and reports what VMs have, or have not, been backed up in the last x hours/days.

We now distinguish between successful backups and backups that ended in warnings. If you work a lot with Application Aware processing and databases for example, you know that a warning can be sometimes rather bad/important. Maybe your database didn’t get properly backed up? Doesn’t do much good to have a working OS if your database is going to fall flat after a restore!

Additional Job Types

I’m happy to say I finally got around to bringing more of what VBR can do into the report. No longer are we restricted to just Backup and Endpoint jobs, we can now report on Replication, Backup Copy, Tape Backup and SureBackup jobs as well! This should cover much of the core functionality of VBR in a VMware environment. These new job type sections follow a similar structure as the existing backup sections.

New Report Sections

A few new report sections were added including Backup Size (total), Session info has been expanded and individual Tasks included. A few job type specific sections were added such as Waiting Tape Sessions (waiting on tape change) and Idle Backup Copy Sessions. A handful of sections were created for Tapes including expired tapes and tapes written to in last x hours/days. Configuration Backups and Scale-Out Repositories both have their own sections now too.

Report Filters

We now have the ability to run the report against just a single job (any flavor)! I know this has been a request for a while now and I finally cleaned up the code enough to do so.

Misc Cleanup

I spent a fair amount of time trying to clean up some of the older code. I tried my best to get it to a point that was easy to understand and follow. I am fully aware that I am not able to create a report that is going to be perfect for everyone. My hope here is that I have given you enough to be able to customize yourself further if desired. The cleanup as well as the addition of only running the heaviest commands if needed has helped speed up the report tremendously (mostly notable on larger environments). In the end the report is still a bit messy, inconsistent and could probably be written by a developer in one tenth the amount of code…but it works 😉

Setup

Download

As the script is now 3x the size prior, I am not going to include it within the post, I’ll just link to the gist here.

Download the zip or copy and paste into a .ps1 file.

Configure

The next step is to configure the (many!) script options which is done in the User-Variables region. There are three variables that must be configured before running.

Add your VBR server name

# VBR Server (Server Name, FQDN or IP)
$vbrServer = "yourVBRserver"

Ensure the path to the Veeam executable is correct

# Location of Veeam executable (Veeam.Backup.Shell.exe)
$veeamExePath = "C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Shell.exe"

Configure Email Settings (or optionally the ‘Save HTML output to file’ section)

# Email configuration
$sendEmail = $true
$emailHost = "smtp.yourserver.com"
$emailUser = ""
$emailPass = ""
$emailFrom = "MyVeeamReport@yourdoamin.com"
$emailTo = "you@yourdomain.com"

That should be enough to get you started. I would recommend leaving the rest as is and just seeing what you get for output (it may be a lot depending on the size of your environment!). From there you can determine what is most important to you and tweak the settings as you desire. As there are so many items returned from the script I foresee some folks setting up multiple scripts for best results. For example, one script to run a daily report on backups, another weekly report for Tape Backup Jobs and possibly another that just lists expired tapes on Fridays – it’s completely up to you, your processes and the size of your environment.

Final Notes

Data retrieval

There were a couple of changes to the way the data is gathered and I wanted to clarify what will be returned.

All job types behave in a similar manor but lets take a look at Backup jobs for the last 24 hours. Previously the last 24 hours only included jobs that were created within that time frame. This has changed to include any jobs that were created within the time frame as well as any jobs that ended within the time frame. For many folks this won’t have much of an effect. If your jobs all run between midnight and 4am and you run a report at 8am – you will see the same results as before. If you have a large backup window or when it comes to continuous job types (Backup Copy/Tape Backup) things can get a little tricky. Hopefully this will help you understand why you are getting the data you are.

Along the same note, things can also get tricky when using the ‘Only Show last Session’ option for a job. This is pretty straight forward for most jobs but Backup Copy jobs in particular act differently than the others due to the continuous nature of the job. You may find the ‘last session’ is sitting idle and hasn’t performed any tasks.

In these scenarios, you may need to get creative in your scheduling to ensure you are getting the data you expect.

Which leads me to…

Validate Everything!

Though I have tried my best to test every possible outcome of the report, I will not be astonished if I have overlooked or fat-fingered something along the way. Please do us all a favor and validate the output against your console to ensure the data returned is correct. If you find something off, please let me know so everyone can benefit from the fix.

Thank You

Lastly, I would once again like to thank all the past and present contributors to this project. I’m not sure I would have had the motivation to start and continue this project entirely on my own and am grateful for all whom have given advice, insight,  tested and/or contributed.

Advertisements

75 thoughts on “Veeam v9 – My Veeam Report v9.0.3

  1. chr1s986

    Great Report! I had some things to uncomment. Eg.”$veeamExePath” and “$VeeamVersion” because I’m not running this Report on the Veeam Server (like in the last Version). And somewhere in the end a “)” is missing.

    Reply
    1. smasterson Post author

      Thanks!
      How/where are you running the script? It should be run either on the VBR server or on a system that has the console installed. I’ve never tested with PS remoting and it really isn’t needed with the console only install now available.
      I suspect your missing “)” is self inflicted as I am unable to find any issues with a fresh download.

      Reply
  2. chr1s986

    I’m running this on my “powershell automation vm”. This machine runs multiple reports every day and also your veeam report 😉 Additionally it runs a webserver to have all the reports in one place.

    Reply
    1. smasterson Post author

      Makes sense, my only suggestion would be to load the console on it. You don’t have to use it other than the PowerShell snapin but would make life a lot easier.

      Reply
      1. smasterson Post author

        OK, now I’m confused. If you have the console installed, why did you have to tweak anything? You would need to change the $veeamExePath which is typically different on a console install but other than that it should run just fine.

      2. chr1s986

        You are right it’s “C:\Program Files\Veeam\Backup and Replication\Console\Veeam.Backup.Shell.exe” if you have installed Console only. But that#s cosmetical in this report.

  3. Leith

    Hi there, I rarely comment on blogs. But I have to say. Great work! This is the best pre-written script around for backup reporting. Thank you.

    Reply
  4. Mauriico

    I ran the script but returns all values in zero (protected vms, etc)
    It returns some exceptions of boolean variables (line 559,576,583, etc)
    What could be happening?
    Thanks in advance

    Reply
  5. Paul Armenakis

    Hey Shawn,

    Loving this report, I’ve been using it for several months now. One question: Is there an easy way to make it report on only a single job instead of the whole server? I’ve modified your script to do it by adding in filters for some of the get cmdlets and it works great, but it was quite a bit of modding, didn’t know if there was an easy way.

    Also, any possibility of adding some sort of veeam cloud connect functionality for us VCC providers?

    Thanks!

    Reply
    1. smasterson Post author

      Hi Paul – glad you like the report
      You can easily specify a single (or multiple) job via the following:
      # Only report on the following Backup Job(s)
      #$backupJob = @(“Backup Job 1″,”Backup Job 3″,”Backup Job *”)
      $backupJob = @(“”)

      As for VCC, I don’t have any access to this, so unlikely I will be able to add myself.

      Reply
  6. Nebz

    Great Work !!! I’m using your script since more than 2 years now ! Very great !!! Do you plan managing multiple VBR servers connections (Prod site and DRP site in my case) ? cause that would make more sense for the %age protected (both VBR need each other’s vCenters… and some vm ARE protected on another VBR server… something to mix all that would be nice). Something to change the order of the components in the Report would be nice too :). Continue ! you’re a beast 🙂

    Reply
    1. smasterson Post author

      Glad you enjoy the script!
      Re multiple VBR servers – I have looked at this briefly and it would be quite an undertaking. It may be something I look at closer down the road but it not anything I am actively working on.
      Re sorting – there are frankly to many tables/fields to provide all the possibilities though all can be changed fairly easily within the code. Let me know what you are looking for and I can try to steer you in the right direction for making the changes that work best for you.

      Reply
      1. Nebz

        Yes i’ve seen your big concatenation but a recurent concat based on a hash with an order would give an easy solution.
        (in the config part you just put an ash with all the titles that you may reuse for the order with a get index at the end of each sections (when you create the var you concat at the end)) so we may just have to change the order of the hash on the begining and tadaaam it’s resorting 😉

    1. smasterson Post author

      Hello – Veeam (therefore the report) is based around jobs – not really setup for per VM reporting. That said, you can filter on just specific jobs if you wish.

      Reply
  7. Peter Robst

    Great report Shawn!!!
    Question….can the data be pulled from Backup Enterprise Manager? I have multiple sites and would like it on one report. I know it would quite large but most of the sites are less than 10 jobs each.

    Reply
  8. warren carrigan

    Shawn, this is really a fantastic and helpful script.

    I too have been working on a script that will report things a bit differently. I’m trying to create report that maps the individual VM and aligns it with all of its living restore points, associated repository/medium, backup size, job, and job duration. I’ve been having some trouble with the tape backup side of things as the VBRRestorePoint doesn’t easily map to a restore point that isn’t on disk.

    Reply
  9. mvandriessen

    Hi Shawn,

    First of all thanks for the awesome script. Really appreciate the effort you put into it.
    Is there currently a way to report VMs that have a backup and replica? Ideally it would be backup, replica and copy job.

    If it’s not available today, maybe you can point me in the right direction and I can add it in myself?

    Thanks,
    Maarten

    Reply
  10. Evan

    Suggestion for future enhancement: “Dashboard” type summary as the FIRST thing on the report. Something to give you a 2 second glance with color coding to know if things are all clear or not based on the different types of jobs— Such as 4 large-ish blocks (Backup, Replication, Backup Copy, Endpoint) that color code as Green or Red. This would be particularly useful when viewing the report on a phone to know if you need to start looking for further issues or can just go about your day because you see all green.

    Reply
  11. Lee

    This is an awesome report script and thank you for your hard work on it! I was wondering if there was a way to define just 1 instance of a vCenter? The reason is I ask is I have esxi servers loaded into veeam but I don’t back them up. I have my vcenter instances loaded in veeam which I do back up. The report is showing my other esxi instances as not backed up and would just like to exclude. Thanks!

    Reply
  12. Mark Lavrijsen (@yomark1)

    I’m running version 9.01 up until now, and with this new version i’m getting massive errors like this:
    The operation ‘[System.Boolean] + [System.Boolean]’ is not defined.
    At C:\scripts\SendEmailv4.ps1:559 char:21
    + If ($showSummaryBk + <<<< $showJobsBk + $showAllSessBk + $showAllTasksBk + $showRunningBk +
    + CategoryInfo : InvalidOperation: (True:Boolean) [], RuntimeException
    + FullyQualifiedErrorId : NotAdefinedOperationForTypeType

    Could it be that powershell v2 is not sufficient anymore?

    Reply
    1. Mark Lavrijsen (@yomark1)

      Can answer my own question. Just upgraded powershell on the Veeam server to version 4. Script seems to work now! Now it needs a little tweaking for our environment(but much less then before, because in earlier version i did some ugly hacking to include basic replica and SuerBackup job info, and that seems to be included nicely now ).

      Great work Shawn, you Rock!

      Reply
    2. smasterson Post author

      Honestly, It’s possible. I no longer run any systems with v2, so am unable to actually test.
      I do run a ‘compatibility checker’ which comes up clean that should catch any issues when running older versions, apparently not a perfect solution.

      Reply
  13. Miraso

    Love the report 🙂
    Made some visual changes to make it look more like the real Veeam report and made the html output 100% width with a little bit of margin left and right.
    When working with VMWare Tags in a large environment this script is a game changer!
    Thanks for your work!

    Reply
  14. Andy Miller

    I love this script, it seems to run fine, but it shoots me an error at the end saying:
    Attempted to divide by zero.
    At C:\Scripts\MyVeeamReport.ps1:1063 char:9
    + $objoutput = New-Object -TypeName PSObject -Property @{
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException
    Any ideas?

    Reply
    1. smasterson Post author

      Do you happen to have an old Replica Target that no longer exists? In this point in the script it is calculating the disk properties of a replica target (datastore).

      Reply
  15. Tuura

    Great report script. Thanks for the effort. Is it also possible to report if VM’s are backed up by multiple/different jobs? Due to miscommunication between operators (on different sites) we had the same VM’s backed up by 2 different jobs. We accidentally found out when a repository ran out of free space.

    Would be great to see this feature in the next versions.

    Keep up the good work!

    Reply
  16. Bernhard

    Hello Shawn,

    i have problem excluding folders. I use the folder names displayed in the VMs and Templates view in the vsphere client but the report includes the vms.
    am i missing something?

    Reply
    1. smasterson Post author

      Do you happen to have vCenter as well as individual hosts defined in VBR? This would actually see two versions of the same VM (one with a vCenter id and another with just a host id)

      Reply
    1. smasterson Post author

      I saw your errors and they don’t appear to be a script issue to me – I’m guessing that the Veeam Powershell plugin got corrupt somehow during your upgrade. I would work with support to see what the issue is.

      Reply
    2. chr1s986

      It works with 9.5 but you have to upgrade your PS Host with the new Veeam Console (including the new PS Snapin) to get it working 🙂

      Reply
  17. Andy Miller

    Is there anyway to make the RPO section and % Protected more based on Replicas? I use them instead of backup jobs and would like to have that more as the baseline.

    Reply
  18. Craig Dalrymple (@cragdoo)

    Great script/report. I’m thinking about trying to create a grafana dashboard, using telegraf to send the metrics into the backend InfluxDB. Is this something you’ve considered/investigated in the past or willing to look at going forward?

    Reply
  19. Jamie

    Hi shawn,
    This is a great script, I’m wondering if you might be able to help me if I wanted to exclude a VMware folder from this section “VMs with No Successful Backups within RPO”?

    Reply
    1. smasterson Post author

      You can exclude VMware folders near line 60:
      # Exclude VMs from Missing and Successful Backups sections in the following (vCenter) folder(s)
      # $excludeFolder = @(“folder1″,”folder2″,”*_testonly”)
      $excludeFolder = @(“”)

      Reply
    1. smasterson Post author

      Unfortunately the script will only run against a single VBR server. In order to scale to multiple VBR servers something would need to be done to hold all the information as this could possibly be MUCH more than you would want to hold in a variable(s)…

      Reply
  20. Dries Vergote

    Hi, great script,
    Can we exclude a complet vcenter? We connect to more than one Vcenter but most of the jobs are running on another vbr server. Now I have them as unprotected vm but they are actualy backup-up.

    Reply
  21. Shubham Sharma

    Hi ,

    M getting below error while running the script .

    Exception calling “Send” with “1” argument(s): “Failure sending mail.”
    At C:\MyVeeamReport.ps1:3644 char:3
    + $smtp.send($msg)
    + ~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException

    Can you please suggest .

    Reply
    1. smasterson Post author

      Hello
      There seems to be an error in your email configuration.
      I would double check that the User Variables for email configuration are correct in the script and you will also want to ensure your smtp server is setup correctly (to allow relaying) as well.

      Reply
  22. Marvin Hazell

    Hi there Shawn. I’ve just come across this powershell report and it has been amazing to see the detail you’ve put into it. Is there a way to grab the info under the History tab in the VBR console? I’m trying to show the frequency and success rate of the jobs that are run.

    Reply
    1. Marvin Hazell

      *Smacks hand on forehead*….I simply had to change the $reportMode. Brain’s been working overtime for too long. Man this thing is a life saver and just plain awesome work. Thanks again.

      Reply
  23. Barrie

    Hi
    Great Report, i am trying to slightly tweak it to my needs and was wondering if anyone could give guidance on how to do the following:

    -Backup Job Status – how can i add last Run Time to this report so i can visually see when last backups ran against the last result colours
    -Backup Job Status – order the results by Target Repo

    Many Thanks

    Reply
  24. Jimmy Berglund

    Great Repport!

    Found this the other week and BOY! what a joy.
    I been working my way upp to make my own repport and problems ive had had already been solved here!

    Ty for your great work and i hope you will continue supporting this projekt.
    Its a great alternative insted of using Veeam one for reporting.

    Reply
  25. Joe Bilbro

    This report appears to be just what we need. We recently had an incident where Veeam stopped backing up 5 servers (we had it set to auto backup everything) after we applied maintenance to our VMWare clusters using the VMWare update manager. No warning, no errors, just stopped backing up 5 virtuals. We discovered it 2 months later (yes, 2 months with no backups for 5 servers, 3 of which were very active file servers) when a customer requested a file restore and we HAD NO BACKUPS of that server.
    According to the info you provided above “Keeping a close eye on jobs is nice but what if someone forgot to add the latest VM to a backup job? This area looks at your entire VMware infrastructure and reports what VMs have, or have not, been backed up in the last x hours/days.” this sounds like your script somehow reads the actively running virtuals. Is it getting this info from vcenter, or veeam, or ?? My concern is that if you are getting the data from Veeam that it may not be accurate. Veeam ‘lost’ the 5 servers we had been previously backing up. The fix was for us to click the ‘recalculate’ button in Veeam. Whatever this triggers it caused Veeam to suddenly see the missing 5 servers and start backing them up again. Hence my concern that you are getting the list of running Virtual servers from Veeam, not directly from VMWare. Please elaborate on how you get the list of currently running virtuals. Thanks in advance!! joe

    Reply
    1. smasterson Post author

      Hi Joe

      You are correct in that we are getting the (not just running, but all) VM information from Veeam. Though possible to interact with VMware, this would require additional modules (PowerCLI) and credentials.

      The script should trigger VBR to do a fresh rescan of the VMware infrastructure.

      Can you elaborate a bit more on the meaning of ‘lost’?
      Were they no longer included in a job? Or did VBR not see them at all in the object browser?

      Reply
      1. Joe Bilbro

        Thanks for your reply!
        When I said ‘lost’, I meant they were no longer included in a backup job. Our backups are by cluster, (not by server) so I would have hoped it would have been automatically picked back up at some point. We discovered another server that was ‘lost’ when this problem started (April 9th) that is still not being backed up by Veeam, even after clicking the ‘recalculate’ button. Your report shows it as not being backed up (yay!). I’m not familiar with the object browser. I am able to go into VIRTUAL MACHINES -> Infrastructure -> virtualcenter.ttuhsc.edu and search for the server and it shows there. I verified today that is has not been backed up since April 9th.
        My concern (and reason for my question) is that Veeam may not be not picking up all the virtuals and storing them in the Veeam database. I’d hoped that your script was going to the source (VMWare) to get the list of current virtual servers rather than relying on Veeam code to get the servers from VMWare and store it. This would eliminate the possibility that Veeam is not getting the server list correctly or possibly just not storing it correctly. At least your script DOES correctly show that this server is not getting backed up. We’re going to get Veeam One on trial and see if it also reports this server as not getting backed up.
        Cool report. Excellent work.
        Final note. It would be awesome if your script would have the option of reading the current server exclude list from a Veeam job and only listing the servers not in an exclude list that didn’t get backed up. I know you provide a place to include excluded servers in the script, but it would be nice to not have to remember to update your script every time we add a server to the exclude list.
        Just a thought. There are probably more valuable features that you are working on, but thought I’d mention it.
        Thanks for your info and your GREAT script!
        joe

  26. Richard Davis

    Excellent script! Is there a way to put the report date in the title of the report and/or the htlm filename attached to the email? I run these everyday for audits and have to retain them. It would be easier for me to manage if each day’s report had a unique title and filename.

    Thanks.

    Reply
    1. Richard Davis

      Found a solution – sorry new to Power Shell. I just had to ad a Get-Date call and put it in the rptTitle string. I had to use a data format that did not have “/” slash characters.

      Reply
  27. Liam Wakefield

    Hi, Thanks for the great report!

    We use this to target Daily jobs – however, is there an option to exlude VM’s within Jobs?

    # Only report on the following Backup Job(s)
    #$backupJob = @(“Backup Job 1″,”Backup Job 3″,”Backup Job *”)
    $backupJob = @(“Daily*”)

    Reply
    1. smasterson Post author

      1) I’ve yet to work with a Hyper-V environment so I doubt it would be something I would do though if someone wanted, this script should give an excellent starting point.
      2) Honestly, I haven’t had time to look into it

      Reply
    1. smasterson Post author

      This should be pretty simple though I have yet to test.

      Replace the following line:
      $smtp = New-Object System.Net.Mail.SmtpClient $emailHost

      With these two lines (replace PORT with whatever port you need, typically 587):
      $smtp = New-Object System.Net.Mail.SmtpClient($emailHost,PORT)
      $smtp.EnableSsl = $true

      That should do the trick. I’ll add to next version (coming soon!).

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s