We are using a RMM-tool which runs a script to check if there is a Warning or Failed in the last Results of the backkup jobs. On 60% of the servers, it runs like it should, but on other servers we are seeing this kind of error:
What does this mean? It can't be the script since it's working on most servers. If I run the script manually on the server it works like it should
Code: Select all
Last Run: Apr-14-2021 - 16:16
Run Time: 0.9962 seconds
Return Code: 0
Standard Error:
Get-VBRJob : The term 'Get-VBRJob' is not recognized as the name of a cmdlet, f
unction, script file, or operable program. Check the spelling of the name, or i
f a path was included, verify that the path is correct and try again.
At C:\Windows\TEMP\trmm\852611403.ps1:3 char:20
+ $VbrJobs = Get-VBRJob | Sort-Object typetostring, name
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VBRJob:String) [], CommandN
otFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Else : The term 'Else' is not recognized as the name of a cmdlet, function, scr
ipt file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At C:\Windows\TEMP\trmm\852611403.ps1:33 char:13
+ Else {
+ ~~~~
+ CategoryInfo : ObjectNotFound: (Else:String) [], CommandNotFoun
dException
+ FullyQualifiedErrorId : CommandNotFoundException
Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
# Get all the jobs
$VbrJobs = Get-VBRJob | Sort-Object typetostring, name
Foreach($Job in $VbrJobs)
{
$JobName = $Job.Name
$Result = $Job.GetLastResult()
If ($Result -eq "Warning") {
$resultc = "Warning"
}
ElseIf ($Result -eq "Failed") {
$resultc = "Failed"
}
If ($Resultc -eq "Warning") {
'Backups have a warning.'
Write-Output $VbrJobs
Exit 1
}
ElseIf ($Resultc -eq "Failed") {
'Backup has failed.'
Write-Output $VbrJobs
Exit 1
}
}
Else {
'The backup is running successfully.'
Write-Output $VbrJobs
Exit 0
}
Exit $LASTEXITCODE