-
- Novice
- Posts: 3
- Liked: never
- Joined: Jan 21, 2020 1:56 pm
- Full Name: David Sjöstrand
- Contact:
Reference to the files created with export-vbrrestorepoint
I want to automate the process of exporting restore points and then movig away the resulting files.
The problem is that export-vbrrestorepoint doesn't seem to return a reference that can be used to locate the actual backup/files.
Export-vbrRestorePoint returns a Veeam.Backup.PowerShell.Infos.VBRSession that contains an Id that can be used with get-vbrrestoresession to find a Veeam.Backup.Core.CRestoreSession. This object, however, does not seem to reference the Veeam.Backup.Core.CBackup or the files created in any way. The name is somewhat predictable, but I would really like to have an unambiguous way to find the exported files.
The problem is that export-vbrrestorepoint doesn't seem to return a reference that can be used to locate the actual backup/files.
Export-vbrRestorePoint returns a Veeam.Backup.PowerShell.Infos.VBRSession that contains an Id that can be used with get-vbrrestoresession to find a Veeam.Backup.Core.CRestoreSession. This object, however, does not seem to reference the Veeam.Backup.Core.CBackup or the files created in any way. The name is somewhat predictable, but I would really like to have an unambiguous way to find the exported files.
-
- Product Manager
- Posts: 9848
- Liked: 2607 times
- Joined: May 13, 2017 4:51 pm
- Full Name: Fabian K.
- Location: Switzerland
- Contact:
Re: Reference to the files created with export-vbrrestorepoint
Hi David
May I know the use case?
You could also use a backup copy job. That would also allow you to automatically "moving away a backup file".
And you can monitor it in the console.
But yes, it would make sense to output the exported path so the backup can be reused for a second command.
I'll try it out myself in the lab.
Thanks
Fabian
May I know the use case?
You could also use a backup copy job. That would also allow you to automatically "moving away a backup file".
And you can monitor it in the console.
But yes, it would make sense to output the exported path so the backup can be reused for a second command.
I'll try it out myself in the lab.
Thanks
Fabian
Product Management Analyst @ Veeam Software
-
- Veeam Software
- Posts: 2123
- Liked: 513 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Reference to the files created with export-vbrrestorepoint
For a normal repository, you can use the Repository Path/Dirpath/etc to get the full string for the path. But for Scale-out Repository, you need to do some fanciness
post443044.html#p443044
I've written this function in the past and you can pass the $ExportedBackup variable and adjust the output to just give you the $PATH result and then pass that to your copy utility.
Here's an example output:
Sorry it's a lot of work, but right now I'm not sure there's a better way.
+1 that it returns the path at that time, but as you can see with Scale-outs, because the paths are relative, that might be tricky.
#MOD: Oleg F. found a better way; removed inefficient/unnecessary method. Use the below to get the file path
post443044.html#p443044
I've written this function in the past and you can pass the $ExportedBackup variable and adjust the output to just give you the $PATH result and then pass that to your copy utility.
Here's an example output:
Code: Select all
PS C:\Users\Administrator\Downloads> Get-StoragesPathsAndBlocksizeFromBackup-v11 -Backup $Exportedbackups[0]
Extent Path BlockSize CreationTime
------ ---- --------- ------------
perf-tier-bb C:\perf-tier-bb\ddom-tinyvm_2022-10-28_1\ddom-tinyvmD2022-10-27T220038_BF53.vbk 4096 10/27/2022 10...
+1 that it returns the path at that time, but as you can see with Scale-outs, because the paths are relative, that might be tricky.
#MOD: Oleg F. found a better way; removed inefficient/unnecessary method. Use the below to get the file path
David Domask | Product Management: Principal Analyst
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Reference to the files created with export-vbrrestorepoint
Hi @David_S
Yes, I think it can be solved by adding session reference in a restore point object.
Noted.
Actually, looks like there is a way to know what backup you exported more or less precisely.
Turns out upon export new backup holds the id of the backup it was exported from in OriginalId property.
Then, using some tweaks and going with naming rules for exported backups we can get this:
So, unless you exported a restore point for the same machine of the very same backup few times a day already, looks like it shows a singular result.
Thanks,
Oleg
Yes, I think it can be solved by adding session reference in a restore point object.
Noted.
Actually, looks like there is a way to know what backup you exported more or less precisely.
Turns out upon export new backup holds the id of the backup it was exported from in OriginalId property.
Then, using some tweaks and going with naming rules for exported backups we can get this:
Code: Select all
$backup = Get-VBRBackup -Name 'Backup Job'
$rps = Get-VBRRestorePoint -Backup $backup
Export-VBRRestorePoint -RestorePoint $rps[-1]
$date = Get-Date -Format "yyyy-MM-dd"
$backupName = "$($rps[-1].Name)_$date"
$exportedBackup = Get-VBRBackup | where {$_.OriginalId -eq $backup.Id `
-and $_.Id -ne $backup.Id -and $_.Name -match $backupName}
$exportedBackup
Thanks,
Oleg
-
- Veeam Software
- Posts: 2123
- Liked: 513 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Reference to the files created with export-vbrrestorepoint
Oh wow! I didn't realize OriginalID actually had a use; thanks @oleg.feoktistov!! I guess maybe @Mildur can remove the first part of my post and just leave the link to finding the fully qualified path of the files, as I suspect that part is still required if it's on Scaleout Repository.
David Domask | Product Management: Principal Analyst
-
- Novice
- Posts: 3
- Liked: never
- Joined: Jan 21, 2020 1:56 pm
- Full Name: David Sjöstrand
- Contact:
Re: Reference to the files created with export-vbrrestorepoint
I need to move a restore point from january for all backed up vms (a few hundred) to another disk (to keep indefinitely). As the export command does not allow me to export to any other repository than the one the backup is on (which also is very weird), and I am limited in space on those repositories, I need to export one restore point, copy it, and then remove the exported files before moving on to the next restore point. All of this has to be automated, and I will have to leave the script running for days or weeks, probably, during which I won't be able to constantly monitor the script. This is why I would like as little ambiguity as possible.Mildur wrote: ↑Oct 28, 2022 8:13 am Hi David
May I know the use case?
You could also use a backup copy job. That would also allow you to automatically "moving away a backup file".
And you can monitor it in the console.
But yes, it would make sense to output the exported path so the backup can be reused for a second command.
I'll try it out myself in the lab.
Thanks
Fabian
-
- Product Manager
- Posts: 9848
- Liked: 2607 times
- Joined: May 13, 2017 4:51 pm
- Full Name: Fabian K.
- Location: Switzerland
- Contact:
Re: Reference to the files created with export-vbrrestorepoint
Hi David
Thanks for explaining the use case.
Thanks for explaining the use case.
Using another repository should be possible starting in V12. Let me check and update my comment if not.As the export command does not allow me to export to any other repository than the one the backup is on (which also is very weird)
Product Management Analyst @ Veeam Software
Who is online
Users browsing this forum: Amazon [Bot], Baidu [Spider] and 11 guests