PowerShell script exchange
Post Reply
cerede2000
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 09, 2014 2:24 pm
Full Name: Benjamin CEREDE
Contact:

Get increment attached to full backup

Post by cerede2000 »

Hello,

I find the last full backup of job with :

Code: Select all

Get-VBRBackup -Name '<Job Name>' | Get-VBRRestorePoint | ?{$_.Type -eq 'Full'} | Sort-Object -Descending CreationTime | Select-Object -First 1
And now I want list all increment wich attached at this full backup.

Please help me.

Thanks.
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get increment attached to full backup

Post by veremin »

You mean you're using forward incremental mode and willing to list all increments that are dependent on that full backup? Thanks.
cerede2000
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 09, 2014 2:24 pm
Full Name: Benjamin CEREDE
Contact:

Re: Get increment attached to full backup

Post by cerede2000 »

I make full backup once day by week.
Between full make incremental.

I want get all incremental that go with the full.
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get increment attached to full backup

Post by veremin »

Then, the following script should be helpful:

Code: Select all

$LastFull = Get-VBRBackup -Name "Name of your Job" | Get-VBRRestorePoint | where {$_.type -eq "Full"} | Sort creationtime -Descending | Select -First 1 
Get-VBRBackup -Name "Name of your Job" | Get-VBRRestorePoint | where {$_.Creationtime -ge $LastFull.CreationTime} | Sort creationtime
The script will list the latest full backup along with the latest increments dependent on it.

Thanks.
cerede2000
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 09, 2014 2:24 pm
Full Name: Benjamin CEREDE
Contact:

Re: Get increment attached to full backup

Post by cerede2000 »

Thanks :)

I saw that there was ParentID.
The increments have it in the full Id ParentID ?

Edit : Because when I get backup chain (full+increment linked) between two full it's not work :(
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get increment attached to full backup

Post by veremin »

I got confused, since you were talking about the last full backup.

Anyway, you can try the following script and see whether it makes any difference. You will have to first assign $N variable that identifies the number of full, starting for the latest one. Be aware that it stats counting from 0, meaning 0 is the latest backup.

Code: Select all

$N = "Number of full"
$Fulls = Get-VBRBackup -Name "Name of your Job" | Get-VBRRestorePoint | where {$_.type -eq "Full"} | Sort creationtime -Descending
$DependentRP = Get-VBRBackup -Name "Name of your Job" | Get-VBRRestorePoint | where {($_.Creationtime -ge $Fulls[$N].CreationTime) -and ($_.getfull().id -eq $Fulls[$N].id)} 
$DependentRP | sort creationtime -Descending | select name, type, creationtime
Thanks.
cerede2000
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 09, 2014 2:24 pm
Full Name: Benjamin CEREDE
Contact:

Re: Get increment attached to full backup

Post by cerede2000 »

Great !!

It's that !

Thank you :)
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get increment attached to full backup

Post by veremin »

I've just noticed that the third line is unnecessary, so, current version has four lines, instead of five. Anyway, glad to hear that my input was helpful.
cerede2000
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 09, 2014 2:24 pm
Full Name: Benjamin CEREDE
Contact:

Re: Get increment attached to full backup

Post by cerede2000 »

Yes i use :

Code: Select all

# Get all fulls
$fulls=Get-VBRBackup -Name 'S3_VCENTER' | Get-VBRRestorePoint | ?{$_.Type -eq 'Full'} | Sort-Object -Descending CreationTime
$increments=Get-VBRBackup -Name 'S3_VCENTER' | Get-VBRRestorePoint | ?{$_.Type -eq 'Increment' -and $_.getFull().Id -eq $full[x].Id}
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests