PowerShell script exchange
Post Reply
Neelakantan
Influencer
Posts: 14
Liked: never
Joined: May 20, 2024 3:12 pm
Full Name: Neelakantan K
Contact:

list of files created during the last session & task of a backup job

Post by Neelakantan »

Hello VBR powershell dev experts,

I would like to know,

1). how to list all the vbk/vbi files those are got created during the last backup session/tasks? (used "Per-machine backup with separate metadata files" as a backup method).
1.a). Can such method/cmdlets be run on any kind of job and list the files on the target storage?

2). Can above be run/evaluated in the post backup script, which would run as part of current backup job?

Thanks,
Neelakantan K.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: list of files created during the last session & task of a backup job

Post by oleg.feoktistov »

Hi,

1) Here is a sample script. It lists backup files created in scope of an indicated job per task sessions in a last session:

Code: Select all

$job = Get-VBRJob -Name 'Backup Job 1'
$backup = Get-VBRBackup | where {$_.JobId -eq $job.Id}
$rps = Get-VBRRestorePoint -Backup $backup
$lastSession = $job.FindLastSession()
$taskSessions = Get-VBRTaskSession -Session $lastSession
foreach ($taskSession in $taskSessions) {
    $createdRp = $rps | where {$_.Name -eq $taskSession.Name -and $_.JobRunId -eq $lastSession.Id}
    $storage = $createdRp.FindStorage()
    $storage | select @{n='FileName';e={$_.PartialPath.ToString()}}, `
    @{n='TaskSessionId';e={$taskSession.Id}}, @{n='TaskSessionName';e={$taskSession.Name}}, `
    @{n='LastSessionId';e={$lastSession.Id}} | fl
}
1.a) You should be able to run it for any kind of VBR machine-based backups. Won't work on NAS or plugin backups, for instance, as the architecture is different there.

2) If you mean these post-job scripts, yes. They are run on a backup server, so shouldn't be a problem.

Best regards,
Oleg
Neelakantan
Influencer
Posts: 14
Liked: never
Joined: May 20, 2024 3:12 pm
Full Name: Neelakantan K
Contact:

Re: list of files created during the last session & task of a backup job

Post by Neelakantan »

Thank you oleg.feoktistov for your prompt response!

A follow up question regarding "Won't work on NAS or plugin backups, for instance, as the architecture is different there."

As a storage vendor, we cannot expect one particular type of backup data files/images. It could possibly some unstructured data files(which veeam VBR backup supports i think) too.

Is there a generic way to identify the list of backed up files(in the current session/task), based on that list of files & backup job configuration, we want to take some action on that list of files?

Thanks in advance and appreciate your help.

Regards,
Neelakantan
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: list of files created during the last session & task of a backup job

Post by oleg.feoktistov »

Is there a generic way to identify the list of backed up files(in the current session/task), based on that list of files & backup job configuration, we want to take some action on that list of files?
I'm afraid currently there isn't. File backups made by Unstructured data jobs (NAS, Object storage backup) have distinct structure: on file system they are literally indexed data blobs with unique ids tied together by metadata, so we don't show them in VBR infrastructure unlike for VM backups. You can see it comparing backup properties of VM and File backups. There isn't really a Veeam cmdlet or a .NET workaround that could get a list of those based on meta and reflect their sizes.

Best regards,
Oleg
Neelakantan
Influencer
Posts: 14
Liked: never
Joined: May 20, 2024 3:12 pm
Full Name: Neelakantan K
Contact:

Re: list of files created during the last session & task of a backup job

Post by Neelakantan »

thanks @oleg.feoktistov
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests