PowerShell script exchange
Post Reply
Herbert Sz
Veeam Software
Posts: 1027
Liked: 201 times
Joined: Oct 02, 2017 7:28 pm
Full Name: Herbert Szumovski
Contact:

Windows Agent Backup find out volume selection

Post by Herbert Sz »

Is there a way to find out via Veeam PS, which volumes are backed up in the respective volume backup job for a server managed Windows agent backup ?
Reason I ask is, customer has to do some post thaw actions on these volumes. I could hardcode them for each specific job, but that's unflexible, and if volumes are added or changed and people forget about the script, it will end badly.
Therefore I would prefer to read the volumes dynamically out of the backp job, it would be the safest method, but found no way to do that via job options or -parameters.
Thanks for any hints or tips.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Windows Agent Backup find out volume selection

Post by oleg.feoktistov » 1 person likes this post

Hi Herbert,

If your customer is on v10, here is the example:

Code: Select all

$jobname = Read-Host -Prompt 'Enter Job Name'
$jobs = Get-VBRComputerBackupJob -Name $jobname
foreach ($job in $jobs) {
    
    if ($job.BackupType -eq 'SelectedVolumes' -and !$job.SelectedVolumes) {
        $job | Select-Object Name, @{n='Volumes';e={'Operating System'}}
    }
    elseif ($job.BackupType -eq 'SelectedVolumes' -and  $job.SelectedVolumes) {
           $volumes = @()
           foreach ($volume in $job.SelectedVolumes) {
            $volumes += $volume.Path
           }
           
           $job | Select-Object Name, @{n='Volumes';e={$volumes}}
    }
}
Best regards,
Oleg
Herbert Sz
Veeam Software
Posts: 1027
Liked: 201 times
Joined: Oct 02, 2017 7:28 pm
Full Name: Herbert Szumovski
Contact:

Re: Windows Agent Backup find out volume selection

Post by Herbert Sz »

Works fine, thanks a lot, Oleg!
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests