Hi All,
Can anyone help us with the script to fetch last 24 hours surebackup status.
Regards,
Surya
-
- Enthusiast
- Posts: 27
- Liked: 4 times
- Joined: Jul 09, 2021 12:42 pm
- Full Name: Suryanarayanan
- Location: Bangalore India
- Contact:
-
- Veeam Software
- Posts: 2714
- Liked: 627 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Need script for fetching last 24 hours surebackup status
Hi Surya,
https://helpcenter.veeam.com/docs/backu ... ml?ver=120
https://helpcenter.veeam.com/docs/backu ... ml?ver=120
Use the cmdlets Get-VBRSureBackupSession to get the job sessions, and you can pass the result of Get-VBRSureBackupSession to Get-VBRSureBackupTaskSession for further details for each workload processed by the SureBackup Job.
To get last 24 hours, add a piped section to Where-Object like below:
$date = Get-Date
$sbSess = Get-VBRSureBackupSession | Where-Object {$_.CreationTime -ge $date.AddDays(-1)} | Sort -Property CreationTime -Descending
This will have a sorted array $sbSess with all the SureBackup job sessions in descending order and return every Surebackup Job session for the last 24 hours (from time of script execution).
https://helpcenter.veeam.com/docs/backu ... ml?ver=120
https://helpcenter.veeam.com/docs/backu ... ml?ver=120
Use the cmdlets Get-VBRSureBackupSession to get the job sessions, and you can pass the result of Get-VBRSureBackupSession to Get-VBRSureBackupTaskSession for further details for each workload processed by the SureBackup Job.
To get last 24 hours, add a piped section to Where-Object like below:
$date = Get-Date
$sbSess = Get-VBRSureBackupSession | Where-Object {$_.CreationTime -ge $date.AddDays(-1)} | Sort -Property CreationTime -Descending
This will have a sorted array $sbSess with all the SureBackup job sessions in descending order and return every Surebackup Job session for the last 24 hours (from time of script execution).
David Domask | Product Management: Principal Analyst
-
- Enthusiast
- Posts: 27
- Liked: 4 times
- Joined: Jul 09, 2021 12:42 pm
- Full Name: Suryanarayanan
- Location: Bangalore India
- Contact:
Re: Need script for fetching last 24 hours surebackup status
Thanks David.
I have developed the script as below
$date = Get-Date
$sbSess = Get-VBRSureBackupSession -Name "*" | Where-Object {$_.CreationTime -ge $date.AddDays(-1)} | Sort -Property CreationTime -Descending
foreach ($session in $sbSess)
{
Get-VBRSureBackupTaskSession -Session $session | Select Name,CreationTime,EndTime,Result,HeartbeatStatus,PingStatus,TestScriptStatus,ValidationTestStatus,RestorePointId,@{n='Jobname';e={$session.Name}}
}
Result:
Name : VM11111111
CreationTime : 20/05/2025 16:02:01
EndTime : 20/05/2025 16:18:03
Result : Success
HeartbeatStatus : Success
PingStatus : NotRunning
TestScriptStatus : Disabled
ValidationTestStatus : Success
RestorePointId : 2843aaf3-01eb-4b99-adcd-fe90ecb6c12e
Jobname : Job1
I have developed the script as below
$date = Get-Date
$sbSess = Get-VBRSureBackupSession -Name "*" | Where-Object {$_.CreationTime -ge $date.AddDays(-1)} | Sort -Property CreationTime -Descending
foreach ($session in $sbSess)
{
Get-VBRSureBackupTaskSession -Session $session | Select Name,CreationTime,EndTime,Result,HeartbeatStatus,PingStatus,TestScriptStatus,ValidationTestStatus,RestorePointId,@{n='Jobname';e={$session.Name}}
}
Result:
Name : VM11111111
CreationTime : 20/05/2025 16:02:01
EndTime : 20/05/2025 16:18:03
Result : Success
HeartbeatStatus : Success
PingStatus : NotRunning
TestScriptStatus : Disabled
ValidationTestStatus : Success
RestorePointId : 2843aaf3-01eb-4b99-adcd-fe90ecb6c12e
Jobname : Job1
Who is online
Users browsing this forum: Google [Bot] and 12 guests