PowerShell script exchange
Post Reply
Refruit
Service Provider
Posts: 34
Liked: 2 times
Joined: Feb 27, 2020 6:38 am
Contact:

Start-VBROffloadBackupFile on partial chain for specific VMs

Post by Refruit »

Hello,

i have multiple VMs backed up in multiple Jobs. Those jobs have 30 days retention with weekly fulls.
Now i want to offload only the oldest full with it's increments of some specific VMs to S3.
At the moment i was thinking of something like this:

Code: Select all

$Backups = "Job1","Job2"
	
Foreach ($Backup in $Backups){$Files += Get-VBRBackupFile -Backup $Backup}

$ArrayofVMs	

Foreach ($VM in $ArrayofVMs) {
	$Data = $Files | Where-Object {$_.Path -like "**$VM*.vbk"}| Sort-Object -Property Path -Descending)[-1]
	Start-VBROffloadBackupFile -BackupFile $Data -ThisBackupAndIncrements
	$Data = $Null
}
So at first i'm collecting all backup files for the jobs.
Afterwards i'm gonna cycle through every VM getting it's oldest full backup file and start offloading.
The question is, as i only got the vbk file, does Veeam find the dependant incrementals automatically or do i need to add them to $Data manually?
How would i accomplish this?

Kind regards,
Refruit
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Start-VBROffloadBackupFile on partial chain for specific VMs

Post by oleg.feoktistov »

Hi,

Yes, Start-VBROffloadBackupFile cmdlet should pick up dependant increments automatically as in your script you use -ThisBackupAndIncrements parameter.

Best regards,
Oleg
Refruit
Service Provider
Posts: 34
Liked: 2 times
Joined: Feb 27, 2020 6:38 am
Contact:

Re: Start-VBROffloadBackupFile on partial chain for specific VMs

Post by Refruit »

Hi Oleg,

thank you for the clarification!

Best regards,
Stefan
Refruit
Service Provider
Posts: 34
Liked: 2 times
Joined: Feb 27, 2020 6:38 am
Contact:

Re: Start-VBROffloadBackupFile on partial chain for specific VMs

Post by Refruit »

Hi there,

i would like to ask a modification for the mentioned script in Post 1.
I want to copy only the oldest full backup with a monthly gfs flag assigned.
How do i accomplish this?

Currently i have something like this:

Code: Select all

$Backups = (Get-VBRBackup -Name "Job1","Job2").GetAllStorages() | sort creationtime -Descending | select PartialPath, CreationTime, GFSPeriod | Where-Object {($_.PartialPath -like "*.vbk") -and ($_.GfsPeriod -ne "None")}
But at the moment i don't know how to convert the result so that it will be accepted as parameter by the Start-VBROffloadBackupFile cmdlet

Regards,
Refruit
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Start-VBROffloadBackupFile on partial chain for specific VMs

Post by oleg.feoktistov »

Hi,

Use Get-VBRBackupFile cmdlet with Id property to present storages as objects of VBRBackupFile type and then pass them to the offload cmdlet. For example:

Code: Select all

$storages = (Get-VBRBackup -Name "Backup Job 1").GetAllStorages() `
| sort creationtime -Descending | select Id, PartialPath, CreationTime, `
GFSPeriod | Where-Object {($_.PartialPath -like "*.vbk") -and ($_.GfsPeriod -ne "None")}
$backupFiles = Get-VBRBackupFile -Id $storages.Id
Start-VBROffloadBackupFile -BackupFile $backupFiles
Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests