but when I created protection group and Server side Agent backup job it just return null
Code: Select all
$agentbackup = # there I get agent backup
$oibs = $agentbackup.GetLastOibs()
#.GetLastPoint() also does not work
Code: Select all
$agentbackup = # there I get agent backup
$oibs = $agentbackup.GetLastOibs()
#.GetLastPoint() also does not work
Code: Select all
PS C:\Users\svc_veeam_br> $agentbackup = Get-VBRBackup -Name 'VeeamOneAgentTest - ausmembertst97.lab.fullstackgeek.net'
PS C:\Users\svc_veeam_br> $agentbackup.GetLastOibs()
VM Name Creation Time Type
------- ------------- ----
ausmembertst97.lab.ful... 8/11/2019 5:37:57 PM Increment
PS C:\Users\svc_veeam_br> $agentbackup.GetLastPoint()
Info : Veeam.Backup.Model.CPointInfo
Id : 04272d5a-3471-44da-90e1-d94eda055f52
CreationTime : 8/11/2019 5:37:16 PM
Algorithm : Increment
Type : Normal
IsFull : False
IsIncremental : True
Code: Select all
Add-PSSnapin *
Connect-VBRServer -server my.vbr.server
#Get all physical agent jobs
$a = Get-VBRJob | Where-Object {$_.JobType -eq "EpAgentBackup"}
#Find CNOs if those are clusters or standalone
$PhysicalClusterName = $a.GetViOijs()
#Get child job that protects machines
$childJob = $a.GetChildJobs()
#Find last backup for physical backups
$lastBackup = $childJob.GetLastBackup()
#Get Last OIBs :D
$result = $lastBackup.GetLastOibs()
$result | Sort-Object -Property fqdn | Format-Table -Property Fqdn, @{L="OIB ID";E={$_.ID}}, BackupID, CreationTimeUTC
Code: Select all
VM Name Creation Time Type
------- ------------- ----
SERVER1 18.06.2019 12:18:57 Increment
SERVER2 28.06.2019 13:16:55 Full
Code: Select all
$intoibs = @($intBackups.GetLastOibs())
$extoibs = @($extBackups.GetLastOibs())
"There is a $($intBackups.Count)($($intoibs.Count)) Internal and $($extBackups.Count)($($extoibs.Count)) External jobs(backups)"
# there is some difference in backups ?
$toEnable = Compare-Object -ReferenceObject $intoibs -DifferenceObject $extoibs -Property Name, CreationTime, IsConsistent -PassThru |
Where-Object { $_.SideIndicator -eq '<=' } |
ForEach-Object {
$b = $_.GetBackup()
$extjobs | Where-Object { $b.JobId -in $_.LinkedJobIds }
} | Sort-Object -Property Name -Unique
$toEnable | Enable-VBRJob
Code: Select all
PS C:\Users\admin> $agentJobs = Get-VBRJob | where {$_.JobType -eq 'EPAgentBackup'}
PS C:\Users\admin> $agentJobs.FindLastSession()
Job Name State Start Time End Time Result
-------- ----- ---------- -------- ------
BACKUP-AGENT-01 Stopped 12/9/2019 4:54:14 PM 12/9/2019 4:55:32 PM Failed
PS C:\Users\oleg.feoktistov>
Code: Select all
PS C:\Users\admin> $job = Get-VBRJob | where {$_.JobType -eq 'EPAgentBackup'}
PS C:\Users\admin> $session = $job.FindLastSession()
PS C:\Users\admin> $session.GetChildSessions() | Select-Object JobName, CreationTime, State, Result
JobName CreationTime State Result
------- ------------ ----- ------
BACKUP-AGENT-01 - WinServer-01 12/11/2019 2:32:38 PM Stopped Success
BACKUP-AGENT-01 - WinServer-02 12/11/2019 2:32:38 PM Stopped Success
Code: Select all
$job = Get-VBRJob | where {$_.JobType -eq 'EPAgentBackup'}
$jobSessions = [Veeam.Backup.Core.CBackupSession]::GetByJob($job.id)
foreach ($jobSession in $jobSessions) {
$jobSession.GetChildSessions() | select JobName, State, EndTime, Result
}
Users browsing this forum: No registered users and 6 guests