Quantcast
Channel: R&D Forums
Viewing all articles
Browse latest Browse all 9997

PowerShell • Return Actions of Backup Copy

$
0
0
Hello,

I have a problem, it’s been several days that I’ve been trying to create a script that returns the actions of the last backup copy. Here’s the script I’ve made so far, the problem is that it only works for normal backups. Here it is:

Code:

$cred = Import-Clixml -Path "**************"Connect-VBRServer -Server "******" -Credential $credImport-Module Veeam.Backup.PowerShell -ErrorAction SilentlyContinue$jobName = Read-Host "Write the name of your backup copy"$job = Get-VBRJob | Where-Object { $_.Name -eq $jobName }if (-not $job) {    $job = Get-VBRBackupCopyJob | Where-Object { $_.Name -eq $jobName }}if (-not $job) {    Write-Host "No job with this name : '$jobName'"    Disconnect-VBRServer    return}$lastSession = $job.FindLastSession()if (-not $lastSession) {    Write-Host "No session for this job : '$jobName'"    Disconnect-VBRServer    return}if ($lastSession) {    foreach ($task in $lastSession.GetTaskSessions()) {        $task.Logger.GetLog().UpdatedRecords |        Select-Object @{Name="VM"; Expression = { $task.Name }},                      StartTime,                      Status,                      Title,                      Action |        Sort-Object StartTime |        Format-Table -AutoSize    }}Disconnect-VBRServer
If you have any other questions, feel free to ask. Thank you in advance for your help!

Statistics: Posted by mateo.chvs — Apr 24, 2025 2:19 pm



Viewing all articles
Browse latest Browse all 9997

Latest Images

Trending Articles



Latest Images