Hi VBR PowerShell developers,
How to list the immediately previous chain backup files using power shell(forward incremental backup method)?
Assume that the previous chain's "last incremental backup" does not yet fall out of window(So, VBR has yet not deleted the previous backup chain).
Thanks,
Neelakantan K.
-
- Influencer
- Posts: 14
- Liked: never
- Joined: May 20, 2024 3:12 pm
- Full Name: Neelakantan K
- Contact:
-
- Veeam Software
- Posts: 2021
- Liked: 673 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: How to list a previous bakup chain files list
Hi Neelakantan,
Try this, customizing the backup name:
Should work if your last restore point is either full or increment. The script gets active backup chain, then takes first chain element's id and determines backup chain for the element that goes before it by index (naturally, it will be the last element in the previous backup chain).
Hope it helps,
Oleg
Try this, customizing the backup name:
Code: Select all
$backup = Get-VBRBackup -Name 'Backup 1'
$rps = Get-VBRRestorePoint -Backup $backup
$firstRp = $rps[-1].GetChain().Id[-1]
foreach ($rp in $rps) {
if ($rp.Id -eq $firstRp) {
$rpIndex = $rps.IndexOf($rp)
$prevChainLastIndex = $rpIndex - 1
}
}
$rps[$prevChainLastIndex].GetChain()
Hope it helps,
Oleg
-
- Influencer
- Posts: 14
- Liked: never
- Joined: May 20, 2024 3:12 pm
- Full Name: Neelakantan K
- Contact:
Re: How to list a previous bakup chain files list
Thanks @oleg.feoktistov,
I have not tested your code, by reading the code i think it has an issue(i accept i may be wrong).
Consider the following chains
[F1->I11->I12->I13-I14] -> [F2->I21->I22->..
So, "$rps" array will have all the above restore points of two chains
$rps[-1] will be "I22" and $rps[-1].GetChain(), will have all the restore points of active chain [F2->I21->I22]
Now, $rps[-1].GetChain().Id[-1] , will fetch Id of "I22" instead of F2.
Should above be changed to "$rps[-1].GetChain().Id[0]" so that it points to "F2". I mean the index should "0" rather than "-1" right?
I have not tested your code, by reading the code i think it has an issue(i accept i may be wrong).
Consider the following chains
[F1->I11->I12->I13-I14] -> [F2->I21->I22->..
So, "$rps" array will have all the above restore points of two chains
$rps[-1] will be "I22" and $rps[-1].GetChain(), will have all the restore points of active chain [F2->I21->I22]
Now, $rps[-1].GetChain().Id[-1] , will fetch Id of "I22" instead of F2.
Should above be changed to "$rps[-1].GetChain().Id[0]" so that it points to "F2". I mean the index should "0" rather than "-1" right?
-
- Veeam Software
- Posts: 2021
- Liked: 673 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: How to list a previous bakup chain files list
No, that's not the case because by default Get-VBRRestorePoint cmdlet sorts restore points from oldest to newest, and with GetChain() method it's the other way around. Thanks though for checking out the code thoroughly!
Who is online
Users browsing this forum: No registered users and 29 guests