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

My Veeam Report v9.5.1

Post by Backerupper » Nov 27, 2017 10:13 pm 9 people like this post

FYI
My Veeam Report has been updated
https://blog.smasterson.com/2017/11/27/ ... rt-v9-5-1/

Fairly comprehensive PowerShell report covering almost all functions of VBR v9.5

MichaelCade
Veeam Software
Posts: 290
Liked: 57 times
Joined: Mar 23, 2015 11:55 am
Full Name: Michael Cade
Location: Cambridge, United Kingdom
Contact:

Re: My Veeam Report v9.5.1

Post by MichaelCade » Nov 27, 2017 10:43 pm 1 person likes this post

How about sharing a sample report ? Looks good though.
Regards,

Michael Cade
Global Technologist
Veeam Software
Email: Michael.Cade@Veeam.com
Twitter: @MichaelCade1

Backerupper
Enthusiast
Posts: 47
Liked: 23 times
Joined: Dec 28, 2012 2:32 pm
Contact:

Re: My Veeam Report v9.5.1

Post by Backerupper » Nov 28, 2017 12:37 am

Excellent idea indeed!

I've updated the post, just needed to find someone to host it for me as I was never able to do it using the current WP template...

tsightler
VP, Product Management
Posts: 5421
Liked: 2243 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: My Veeam Report v9.5.1

Post by tsightler » Nov 28, 2017 3:03 am

Hey Shawn, great update! I actually have a patch I've been meaning to share with you as I've had several customers that wanted to aggregate retries so that, if a VM was successful on retry, it would not be reported as failed, as this led to confusion when the report was send to operations personnel or, in some cases, management, because they would see failures and assume the VM was not backed up. Not sure if you'd be interested in incorporating this logic into the main report (it was enabled only as an option and just added some logic). If you think this would be generally useful for others, I'd be happy to try to roll it into this update and share it, if not I'll just hold it as a separate patch.

Backerupper
Enthusiast
Posts: 47
Liked: 23 times
Joined: Dec 28, 2012 2:32 pm
Contact:

Re: My Veeam Report v9.5.1

Post by Backerupper » Nov 28, 2017 12:18 pm

Hey Tom

I believe something along these lines was added in a past version via:
# Only show last Session for each Backup Job
$onlyLastBk = $false

If set to $true, you will only see results from the latest session (similar to what is seen in the console). I consider this to be more of a 'per job' view rather than 'per session'.

I'd certainly be interested if you are thinking something different or have better logic.

Personally, I am tossed on the issue. I totally understand the desire for a 'clean' report but I also think it is good to know if certain VMs are constantly having issues with backups. The best compromise may be to set to $true for the daily report then run another 'more in-depth' report weekly showing all sessions for archival/investigative purposes.

MichaelCade
Veeam Software
Posts: 290
Liked: 57 times
Joined: Mar 23, 2015 11:55 am
Full Name: Michael Cade
Location: Cambridge, United Kingdom
Contact:

Re: My Veeam Report v9.5.1

Post by MichaelCade » Nov 28, 2017 12:51 pm

Thanks for posting the sample report - http://jasonclarke.org/MVR951.html
Regards,

Michael Cade
Global Technologist
Veeam Software
Email: Michael.Cade@Veeam.com
Twitter: @MichaelCade1

tsightler
VP, Product Management
Posts: 5421
Liked: 2243 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: My Veeam Report v9.5.1

Post by tsightler » Nov 28, 2017 4:54 pm

Backerupper wrote:Hey Tom

I believe something along these lines was added in a past version via:
# Only show last Session for each Backup Job
$onlyLastBk = $false

If set to $true, you will only see results from the latest session (similar to what is seen in the console). I consider this to be more of a 'per job' view rather than 'per session'.

I'd certainly be interested if you are thinking something different or have better logic.
I don't think it's quite the same, but it's been a while, so I'll go retest it, but I remember that feature being there and it not being exactly what they were looking to do. I should be able to run this in my lab as I still have the old code and new code.

vanakenarch
Novice
Posts: 8
Liked: never
Joined: Sep 17, 2014 7:28 am
Full Name: Lars Bemelmans
Contact:

Re: My Veeam Report v9.5.1

Post by vanakenarch » Dec 04, 2017 10:31 am

Backerupper wrote:FYI
My Veeam Report has been updated
https://blog.smasterson.com/2017/11/27/ ... rt-v9-5-1/

Fairly comprehensive PowerShell report covering almost all functions of VBR v9.5
Thank you Backerupper, this is a nice piece of reporting :D
Lars.

antipolis
Enthusiast
Posts: 71
Liked: 9 times
Joined: Oct 26, 2016 9:17 am
Contact:

Re: My Veeam Report v9.5.1

Post by antipolis » Dec 13, 2017 9:54 am

Greetings,

I am trying to implement reports using this script

only problem I have is one repo shows as warning :

Repository NameTypeMax TasksHostPath
NetApp SnapShotUnknown4xxxx.xxxx.xxNetApp Storage

(Host path shows the name of my veeam server)

Now we previously used netapp storage indeed, but that is not the case anymore. I removed netapp storage from storage infrastructure, and nothing apart from my regular repos are listed under backup infrastructure. Also disabled storage integration from all my backup jobs, but I still can't get rid of that "NetApp SnapShot" repo :
PS C:\Users\xxx> Get-VBRBackupRepository -name netapp* |ft name,description

Name Description
---- -----------
NetApp SnapShot Primary storage snapshot only

PS C:\Users\xxx> get-vbrbackuprepository -Name NetApp* |Remove-VBRBackupRepository -Confirm:$false
Remove-VBRBackupRepository : NetApp SnapShot based repository cannot be deleted.
any ideas ?

veremin
Product Manager
Posts: 16901
Liked: 1438 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: My Veeam Report v9.5.1

Post by veremin » Dec 13, 2017 12:16 pm

You can modify script slightly, so that it selects all but netapp repository. Otherwise, contact our support team - chances are, there are stuck references in configuration db. Thanks.

antipolis
Enthusiast
Posts: 71
Liked: 9 times
Joined: Oct 26, 2016 9:17 am
Contact:

Re: My Veeam Report v9.5.1

Post by antipolis » Dec 13, 2017 12:29 pm

Not that big of a deal but yes I might just do that... out of OCD :P

modified the script in the meantime

thanks

Backerupper
Enthusiast
Posts: 47
Liked: 23 times
Joined: Dec 28, 2012 2:32 pm
Contact:

Re: My Veeam Report v9.5.1

Post by Backerupper » Dec 22, 2017 2:39 pm 2 people like this post

Just a quick note that My Veeam Report has been updated for VBR 9.5 Update 3

https://blog.smasterson.com/2017/12/22/ ... ort-9-5-3/

aschillling
Novice
Posts: 9
Liked: never
Joined: Sep 15, 2017 7:52 pm
Full Name: Andrew W Schilling
Contact:

Re: My Veeam Report v9.5.1

Post by aschillling » Mar 12, 2018 3:15 pm

If you update the report in the near future, can you please add code to exclude based on specific vSphere Tags? We assign to backup jobs based on tags and I've made modifications myself for those exclusions. If you can add a section status of SQL transaction log backups that would be great too, I haven't been able to pull that data with PowerShell just yet.

alexis.courteix
Novice
Posts: 4
Liked: never
Joined: Mar 21, 2018 8:41 am
Full Name: Alexis Courteix
Location: Clermont-Ferrand
Contact:

Re: My Veeam Report v9.5.1

Post by alexis.courteix » Apr 20, 2018 8:39 am

Your script is really great, and I use it regularly !

I only see a little issue since I can't have my templates excluded from the VM list ($excludeVMs) since they are named in a way that doesn't let them to be excluded, e.g. "[template] MyCompany_2008_R2_Standard_Enterprise_US_SP1"
I tried to add escape characters (`) but it didn't work.

Other than that, may I suggest a few features to be included for the next version:
- retrieve WAN Accelerators cache location/size/free space
- indicate report build duration (sometimes the script can take quite some time to perform)
- have backup size (GB) with only two decimals to avoid values such as 2436,539999999999

Thanks.

veremin
Product Manager
Posts: 16901
Liked: 1438 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: My Veeam Report v9.5.1

Post by veremin » Apr 20, 2018 4:47 pm

Have you tried to identify templates, using IsTemplate property?

The following code should return all templates residing on particular host or vCenter:

Code: Select all

$Server = Get-VBRServer -name "ServerName"
$Templates = Find-VBRViEntity -Server $Server | where {$_.IsTemplate -eq $True}
Then, it's just a matter of excluding those templates from processing.

Thanks.

alexis.courteix
Novice
Posts: 4
Liked: never
Joined: Mar 21, 2018 8:41 am
Full Name: Alexis Courteix
Location: Clermont-Ferrand
Contact:

Re: My Veeam Report v9.5.1

Post by alexis.courteix » Apr 23, 2018 6:34 am

v.Eremin wrote:Have you tried to identify templates, using IsTemplate property?
Not yet, but that's a good idea.
Still, it's best for a lazy guy like me to have these kind of issues managed directly in Shawn's script ;)

veremin
Product Manager
Posts: 16901
Liked: 1438 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: My Veeam Report v9.5.1

Post by veremin » Apr 23, 2018 12:52 pm

It should not be too hard to add this section to original script. There must list of exclusions or list of objects to process is created, just incorporate the suggested part into it. Thanks.

alexis.courteix
Novice
Posts: 4
Liked: never
Joined: Mar 21, 2018 8:41 am
Full Name: Alexis Courteix
Location: Clermont-Ferrand
Contact:

Re: My Veeam Report v9.5.1

Post by alexis.courteix » Apr 23, 2018 2:57 pm

In the script, the function Get-VMsBackupStatus already makes use of the IsTemplate property.
The thing is that the regular expression code dealing with the exclusions manages incorrectly symbols such as [ ]

Code: Select all

$excludeVMs = @("[template] 2012R2_US", "[template] 2008R2_FR","VM1","VM2")
$excludevms_regex = ('(?i)^(' + (($script:excludeVMs | ForEach {[regex]::escape($_)}) -join "|") + ')$') -replace "\\\*", ".*"
Write-Output $excludevms_regex
The output I get:
(?i)^(\[template]\ 2012R2_US|\[template]\ 2008R2_FR|VM1|VM2)$

The output I would have expected:
(?i)^([template] 2012R2_US|[template] 2008R2_FR|VM1|VM2)$

tsightler
VP, Product Management
Posts: 5421
Liked: 2243 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: My Veeam Report v9.5.1

Post by tsightler » Apr 23, 2018 9:39 pm

That regex code looks like it was taken directly from my original Unprotected VMs Report from back in 2011, which in turn was just ripped largely from another example of code I had found online. It doesn't completely surprise me it won't deal properly with special symbols, however, the escape section looks correct to me and the regex output that you get actually seems correct as the bracket character needs to be escaped with the \ so that it will match literally since brackets have special meanings in regex. I double checked in an online regex checker, and the first one matches the string properly as written. I'll try to dig a little deeper and see why it's not working.

However, if you just want to exclude all templates from your report (perhaps that's not your goal, but just in case), you should be able to just set $excludeTemp = $true.

tsightler
VP, Product Management
Posts: 5421
Liked: 2243 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: My Veeam Report v9.5.1

Post by tsightler » Apr 23, 2018 10:00 pm

I did a little more testing and the code above still seems functional to me. I created a simple test like this:

Code: Select all

$VMs = @("[template] 2012R2_US", "Test1", "Test2", "VM1", "VM2")
$excludeVMs = @("[template] 2012R2_US", "[template] 2008R2_FR","VM1","VM2")
$excludevms_regex = ('(?i)^(' + (($script:excludeVMs | ForEach {[regex]::escape($_)}) -join "|") + ')$') -replace "\\\*", ".*"
Write-Output $excludevms_regex
$VMs | Where-Object {$_ -notmatch $excludevms_regex}
And the output generated from this was:

Code: Select all

(?i)^(\[template]\ 2012R2_US|\[template]\ 2008R2_FR|VM1|VM2)$
Test1
Test2
Which is exactly correct and shows that the matching for the regex itself actually is correct since the US template as well as VM1 and VM2 were excluded based on the regex.

Can you provide the output of the following (you can PM me if you want to avoid posting your templates names on the public fourm):

Code: Select all

(Find-VBRViEntity -VMsandTemplates | ?{$_.IsTemplate -eq "True"}).Name

alexis.courteix
Novice
Posts: 4
Liked: never
Joined: Mar 21, 2018 8:41 am
Full Name: Alexis Courteix
Location: Clermont-Ferrand
Contact:

Re: My Veeam Report v9.5.1

Post by alexis.courteix » Apr 24, 2018 12:52 pm

It's not needed anymore : you pointed out my mistake :)
Since I had the templates appear as prefixed as "[template] " in the report, I mentioned them this way in the exclusion list instead of checking their real name.
And now, it works fine.
Thanks for your help !

dblevins66
Lurker
Posts: 1
Liked: never
Joined: Mar 05, 2018 9:25 pm
Full Name: Dale Blevins
Contact:

[MERGED] Gets a list of servers backed up within the past #

Post by dblevins66 » May 10, 2018 10:12 pm

Hi all. I am struggling trying to get a PowerShell script setup that I can use to determine how many backups are done in a certain amount of time. I need it to dump the server names of servers backed in via Repositories and dump to a file for massage and use to generate numerous other reports. There are two different repositories on the Veeam master and need to exclude the servers depending on which repository is being searched. Back up by cluster mode so the VBRBackup command only returns the cluster names. I have the following line I use but need something more to determine which servers to exclude via repository. The line below works but outputs all the backups on both repositories.

Get-VBRRestorePoint -Name * | where {$_.CreationTime -gt $2weeks} | sort-object @{Expression={$_.Name}} -unique

veremin
Product Manager
Posts: 16901
Liked: 1438 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: My Veeam Report v9.5.1

Post by veremin » May 24, 2018 9:58 pm

Check the report pack above. There should be a report similar to the one you're trying to create. Thanks.

vmuolo
Lurker
Posts: 1
Liked: never
Joined: Sep 21, 2018 12:45 pm
Full Name: Vincenzo Muolo
Contact:

Re: My Veeam Report v9.5.1

Post by vmuolo » Sep 21, 2018 12:56 pm

Hi

It's possible to have your report that's include also the results ( such as last session ) of veeam backup agent ( "free" edition ) ?

We have configurated several our pc where we have installed the related veaam agent .

Thanks laso in advance

Vincenzo Muolo

nanii-60
Influencer
Posts: 13
Liked: 1 time
Joined: Jan 17, 2019 10:09 am
Full Name: Fabien ROUSSILLON
Location: Paris, FRANCE
Contact:

Re: My Veeam Report v9.5.1

Post by nanii-60 » Feb 20, 2019 11:15 am

Hello,
Have you a new version for VBR 9.5 Update 4 ? Because agent backup doesn't work with the script.

Ctek
Service Provider
Posts: 69
Liked: 9 times
Joined: Nov 11, 2015 3:50 pm
Location: Canada
Contact:

Re: My Veeam Report v9.5.1

Post by Ctek » Mar 13, 2019 6:31 pm

Is someone was able to make this script work with Hyper-v?
VMCE 9 Certified - Systems Administrator

Zach123
Influencer
Posts: 15
Liked: never
Joined: Jun 04, 2019 12:36 am
Full Name: zaki khan
Contact:

Re: My Veeam Report v9.5.1

Post by Zach123 » Jun 04, 2019 12:38 am

In response to "Have you a new version for VBR 9.5 Update 4 ? Because agent backup doesn't work with the script."

How can I make the agent backups to report with 9.5.4 using the script as most of our backups are agent based.

veremin
Product Manager
Posts: 16901
Liked: 1438 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: My Veeam Report v9.5.1

Post by veremin » Jun 04, 2019 6:41 pm

You can use one of these workarounds to get either agent jobs or agent backups and incorporate new logic to the said script. Thanks!

DavidL86
Influencer
Posts: 12
Liked: 1 time
Joined: Dec 21, 2018 5:12 pm
Full Name: David LETTIERI
Contact:

Re: My Veeam Report v9.5.1

Post by DavidL86 » Jun 11, 2019 4:11 pm

Hello,

Great Job, I love this report !
Quick question though, how can I send to multiple mail adresses ? I tried but couldn't find the right syntax, I'm newb in PS.

Thanks !

DavidL86
Influencer
Posts: 12
Liked: 1 time
Joined: Dec 21, 2018 5:12 pm
Full Name: David LETTIERI
Contact:

Re: My Veeam Report v9.5.1

Post by DavidL86 » Jun 11, 2019 4:28 pm 1 person likes this post

Nvm found the solution.
In case anyone is looking for it :

Replace $emailTo by $emailToAddresses at the beginning of the script and add the mail addresses

Code: Select all

$emailToAddresses = @("aze@aze.com","ert@aze.com")[/b]

Then add the following [b]line[/b] at the end of the script in the Send Email Section. Dont forget the "{" "}"

#region Output
# Send Report via Email
If ($sendEmail) {
  $smtp = New-Object System.Net.Mail.SmtpClient($emailHost, $emailPort)
  $smtp.Credentials = New-Object System.Net.NetworkCredential($emailUser, $emailPass)
  $smtp.EnableSsl = $emailEnableSSL
	foreach ($EmailTo in $EmailToAddresses)
  {
  $msg = New-Object System.Net.Mail.MailMessage($emailFrom, $emailTo)
...
...
}

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests