PowerShell script exchange
Post Reply
jbyoon
Novice
Posts: 6
Liked: never
Joined: Feb 06, 2020 12:07 pm
Full Name: YOON JOO BYOUNG
Contact:

Question - Backup Job check powershell for Last 24 hours

Post by jbyoon »

I have powershell. But this powershell is Check only last Backup Status.

Get-VBRJob | Where-Object {$_.GetLastResult()} -ne "aa"| Select-object @{Name="Job";Expression={$_.Name}}, @{Name="Status";Expression={$_.GetLastResult()}}, @{Name="ID";Expression={$_.id}}, @{Name="Job Msg";Expression={$_.FindLastSession().info.description}}, @{Name="Session";Expression={$_.FindLastSession()}} | Select-Object "Job","Status","ID"

I Know Get-VBRJobSession command But this command is only VM Status return. (Agent for windows or Linux Status not Return)
I would like to know the PowerShell commands to check the success and failure of all backup jobs(VM, Physical Linux & Windows) for Last 24 hours.

Regards,
JB
Vek17
Service Provider
Posts: 49
Liked: 15 times
Joined: May 29, 2018 8:42 pm
Contact:

Re: Question - Backup Job check powershell for Last 24 hours

Post by Vek17 » 1 person likes this post

If you want all sessions in the past 24 hours including agents you can do this

Code: Select all

$PreviousDay = [DateTime]::Now.AddHours(-24)
[Veeam.Backup.Core.CBackupSession]::GetAll() | Where-Object {$_.EndTime -gt $PreviousDay -or $_.StartTime -gt $PreviousDay} | Measure-Object
Daniel2
Enthusiast
Posts: 45
Liked: 21 times
Joined: Nov 25, 2019 8:16 am
Full Name: Daniel
Contact:

Re: Question - Backup Job check powershell for Last 24 hours

Post by Daniel2 »

Replace StartTime with CreationTime. CBackupSession does not have a StartTime.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 9 guests