I am using Powershell to query the status of my backup. However, I get errors in the status query that I can't explain. Can you help me?
WARNING: This cmdlet is no longer supported for computer backup jobs. Use
"Get-VBRComputerBackupJob" instead.
Add-PsSnapin : The Windows PowerShell snap-in "VeeamPSSnapIn" is not installed on this computer.
My PowerShell Code:
Code: Select all
param([string]$excluded_jobs = "")
if($excluded_jobs -ne "")
{
$excluded_jobs_array = $excluded_jobs.Split(",")
}
#Adding required SnapIn
if((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null)
{
Add-PsSnapin VeeamPSSnapIn
}
$output_jobs_failed = ""
$output_jobs_warning = ""
$nagios_output = ""
$nagios_state = 0
$output_jobs_failed_counter = 0
$output_jobs_warning_counter = 0
$output_jobs_success_counter = 0
$output_jobs_none_counter = 0
$output_jobs_working_counter = 0
$output_jobs_skipped_counter = 0
$jobs = Get-VBRJob
ForEach($job in $jobs)
{
$status = $job.GetLastResult()
$state = $($job.findlastsession()).State
#Parse the date when the job last run
$runtime = $job.GetScheduleOptions()
$runtime = $runtime -replace '.*Latest run time: \[', ''
$runtime = $runtime -replace '\], Next run time: .*', ''
$runtime = $runtime.split(' ')[0]
I would be very pleased to receive help!