We are using the following code lines in a reporting script to retrieve all restore points from a backup:
..
$Backup = Get-VBRBackup -Id $BackupID
$Backup | Get-VBRRestorePoint
..
Some of the backups have no servers associated and therefore no restore points. Therefore an empty object should be returned, this worked in the past.
Since the update to 12.3.1 however the command returns ALL restore points instead and not only the ones from the backup. This unfortunately broke the reporting. Can somebody confirm this?
Greetings
Stephan
-
- Influencer
- Posts: 17
- Liked: 1 time
- Joined: Jul 16, 2024 9:30 am
- Full Name: Stephan
- Contact:
-
- Veeam Software
- Posts: 2744
- Liked: 630 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Get-VBRRestorePoint broken since last update
Hi Stephan,
I checked both 12.2 and 12.3 for Get-VBRRestorePoint, the pipeline validations haven't changed. I think part of the confusion here is that Get-VBRRestorePoints tries to do parameter binding, Powershell decides on its own how to do the binding and it's a bit unpredictable.
This is an issue because the -Backup parameter has AllowEmptyCollection for one of the bindings so powershell won't error out here. Instead there is handling that if the parameter ends up being empty, all backups are returned, and this was true in 12.2 it looks.
I can't explain why you're only hitting this on 12.3.1, but honestly I would not do this in a script
>$Backup | Get-VBRRestorePoint
I'm not sure there's much of a benefit and we end up having to battle with powershell's pipeline behavior. Instead do
$rp = Get-VBRRestorePoint -Backup $backup
Directly using the parameter will validate NotNullOrEmpty, and should properly catch and continue.
Similarly, can you explain a bit more how you ended up with backups that have no restore points? I'm a bit confused how this scenario appeared and off the top of my head cannot think how to reproduce it.
I checked both 12.2 and 12.3 for Get-VBRRestorePoint, the pipeline validations haven't changed. I think part of the confusion here is that Get-VBRRestorePoints tries to do parameter binding, Powershell decides on its own how to do the binding and it's a bit unpredictable.
This is an issue because the -Backup parameter has AllowEmptyCollection for one of the bindings so powershell won't error out here. Instead there is handling that if the parameter ends up being empty, all backups are returned, and this was true in 12.2 it looks.
I can't explain why you're only hitting this on 12.3.1, but honestly I would not do this in a script
>$Backup | Get-VBRRestorePoint
I'm not sure there's much of a benefit and we end up having to battle with powershell's pipeline behavior. Instead do
$rp = Get-VBRRestorePoint -Backup $backup
Directly using the parameter will validate NotNullOrEmpty, and should properly catch and continue.
Similarly, can you explain a bit more how you ended up with backups that have no restore points? I'm a bit confused how this scenario appeared and off the top of my head cannot think how to reproduce it.
David Domask | Product Management: Principal Analyst
-
- Influencer
- Posts: 17
- Liked: 1 time
- Joined: Jul 16, 2024 9:30 am
- Full Name: Stephan
- Contact:
Re: Get-VBRRestorePoint broken since last update
Hi David
Thanks for the fast response and your suggestions. I tested a lot and it doesn't matter how I a pass the backup object to Get-VBRRestorePoint, it always returns all restore points for the environment.
This variant does not work: >$rp = Get-VBRRestorePoint -Backup $backup
I'm not 100% sure why we have backups without restore points but I think it is due to special backups (one-time style) with different retentions that we do for certain customers from time to time. Once those are expired, the backup object remains empty until the next run.
Greetings
Stephan
Thanks for the fast response and your suggestions. I tested a lot and it doesn't matter how I a pass the backup object to Get-VBRRestorePoint, it always returns all restore points for the environment.
This variant does not work: >$rp = Get-VBRRestorePoint -Backup $backup
I'm not 100% sure why we have backups without restore points but I think it is due to special backups (one-time style) with different retentions that we do for certain customers from time to time. Once those are expired, the backup object remains empty until the next run.
Greetings
Stephan
-
- Veeam Software
- Posts: 2744
- Liked: 630 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Get-VBRRestorePoint broken since last update
Honestly Stephan, I consider a restore-pointless backup an error state for the backup, and I'm a bit unclear how it happened. I will PM you here as I've got a few questions that will be spammy on the boards.
For your immediate script needs, I would do a check on $backups to find if it's an "empty" backup (I think the Count property should work), and if it empty, log it and Continue in your loop.
For your immediate script needs, I would do a check on $backups to find if it's an "empty" backup (I think the Count property should work), and if it empty, log it and Continue in your loop.
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: Amazon [Bot] and 1 guest