PowerShell script exchange
Post Reply
unsichtbarre
Service Provider
Posts: 234
Liked: 40 times
Joined: Mar 08, 2010 4:05 pm
Full Name: John Borhek
Contact:

MyVeeamReport.ps1 updated?

Post by unsichtbarre »

Hi All,

I was wondering if there was an updated version of MyVeeamReport.ps1 https://gist.github.com/smasterson/9136468

Available anywhere?

THX,
-John
John Borhek, Solutions Architect
https://vmsources.com
Mildur
Product Manager
Posts: 9848
Liked: 2610 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: MyVeeamReport.ps1 updated?

Post by Mildur » 1 person likes this post

Hello John

MyVeeamReport.ps1 is not managed by us (Veeam or Veeam RnD). I don't know if there is a new version of it.

If you are looking for a report, I can recommend you "Veeam VBR As Built Report" from one of our community members:
Forum: powershell-f26/asbuiltreport-veeam-vbr- ... 78470.html
Github: https://github.com/rebelinux/AsBuiltReport.Veeam.VBR

Best,
Fabian
Product Management Analyst @ Veeam Software
unsichtbarre
Service Provider
Posts: 234
Liked: 40 times
Joined: Mar 08, 2010 4:05 pm
Full Name: John Borhek
Contact:

Re: MyVeeamReport.ps1 updated?

Post by unsichtbarre »

Hi Mildur,

The suggested script looks great, except it reports Veeam configuration, not jobs/status. I am looking for a PS report that will export successful/warning/failed from a specific time period.

THX,
-John
John Borhek, Solutions Architect
https://vmsources.com
david.domask
Veeam Software
Posts: 2163
Liked: 519 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: MyVeeamReport.ps1 updated?

Post by david.domask » 1 person likes this post

Hi John,

If it's just setting time periods, you can do this with one of two cmdlets:

Get-VBRBackupSession
Get-VBRSession

A very simple version would be:

Code: Select all

$date = Get-Date
$sessions = Get-VBRBackupSession | Where-Object {$_.CreationTime -ge $date.AddDays(-1)}
Example output:

Code: Select all

PS C:\Users\david.LAB> $date = Get-Date
PS C:\Users\david.LAB> Get-VBRBackupSession | Where-Object{$_.CreationTime -ge $date.AddDays(-1)}

Job Name             State      Start Time             End Time               Result
--------             -----      ----------             --------               ------
BCJ-nano-xfs\BJ-n... Stopped    24.09.2024 11:32:16    24.09.2024 11:34:37    Warning
BCJ-FK-Immediate-... Stopped    23.09.2024 22:07:06    23.09.2024 22:14:18    Success
BCJ-from-BCJ-nano... Stopped    23.09.2024 20:00:06    23.09.2024 20:02:27    Success
BCJ-nano-xfs\BJ-n... Stopped    24.09.2024 12:32:24    24.09.2024 12:34:45    Warning
BCJ-nano-xfs\BJ-n... Stopped    23.09.2024 22:32:24    23.09.2024 22:34:46    Warning
BCJ-VCC-Migration... Stopped    24.09.2024 14:57:15    24.09.2024 14:59:44    Success
BCJ-mirror-nano\B... Stopped    24.09.2024 14:57:15    24.09.2024 14:59:36    Success
BCJ-FK-Nano\BJ-Na... Stopped    24.09.2024 14:57:15    24.09.2024 14:59:37    Success
BCJ-FK-Immediate-... Stopped    24.09.2024 14:57:15    24.09.2024 15:04:33    Success
That will return probably a lot and the format might not be suitable, so probably once you collect the sessions to the $sessions array, you can later build out a desired PSCustomObject based on the properties you want to report on.

Please note though that in very active/busy environments, Get-VBRBackupSession might be a bit slow -- as a simple workaround, consider the same strategy with Get-VBRSession and the -Type parameter. Use Get-Help Get-VBRSession to see the possible values for -Type, but basically it returns a more petite version of the same session information and the -Type filter further reduces the processing time.

Example:

Code: Select all

$date = Get-Date
$sessions = Get-VBRSession -Type Backup | Where-Object {$_.CreationTime -ge $date.AddDays(-1)
Specifying a date range is as simple as just using the -AND operator in the Where-Object expression, for example:

Code: Select all

$date = Get-Date
$startDate = $date.AddDays(-31)
$endDate = $date.AddDays(-24)
$session = Get-VBRBackupSession | Where-Object {$_.CreationTime -ge $startDate -And $_.CreationTime -le $endDate}
Give it a shot and see if it meets your reporting needs.
David Domask | Product Management: Principal Analyst
JaySt
Service Provider
Posts: 454
Liked: 86 times
Joined: Jun 09, 2015 7:08 pm
Full Name: JaySt
Contact:

Re: MyVeeamReport.ps1 updated?

Post by JaySt »

not hijacking this, but somewhat related:
any sight on cmdlet Get-VBRBackupSession getting date filtering parameters? So without needing to pipe it into where-object?
The cmdlet does not scale that well as you mentioned.
Using Get-VBRSession to further filter on e.g. -Type is OK-ish, but you'll eventually just want to filter on a timeframe as well, for efficiency reasons.
Is there some reason why this is not implemented yet?
Veeam Certified Engineer
scrat
Enthusiast
Posts: 50
Liked: 4 times
Joined: Jul 26, 2022 5:14 pm
Contact:

Re: MyVeeamReport.ps1 updated?

Post by scrat »

Hello,
I have a version updated to v12 (for example, I have added Object Storage Jobs). @Veeam, how can I share the files?
david.domask
Veeam Software
Posts: 2163
Liked: 519 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: MyVeeamReport.ps1 updated?

Post by david.domask »

Hi scrat,

The script is not maintained by Veeam officially, so I think you can fork the project to your own repo or discuss with the original author: https://gist.github.com/smasterson/4d28 ... 90993dd728

@JaySt, the request is a known one, and right now nothing new to share regarding the request. For the time being, we can use the supported workarounds and also unsupported methods via .net reflection with [Veeam.Backup.Core.CBackupSession]. While normally I would advise against unsupported methods due to potential breaking changes between updates, this method likely will be "safe" to continue working with and will be a bit faster if the official cmdlets are not performant enough.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 20 guests