
I have the following script:
Code: Select all
##############################################################################
# in Powershell (x86) und Powershell:
# "Set-Executionpolicy Unrestricted"
# Host Monitor Test to check for successful Veaam jobs
# Has to run in 64 Bit PS!!!
# "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe %Script% %Params%"
# PS script by PR
# copyright EPC GmbH 2015
##############################################################################
# HM return output
$StatusOk = "ScriptRes:Ok:"
$StatusBad = "ScriptRes:Bad:"
Add-PsSnapin -Name VeeamPSSnapIn
$arr_Result = ""
# Get all successfull jobs which are not continuous
$jobs_Success = Get-VBRJob | Where-Object {
$_.GetLastResult() -eq "Success" -and $_.IsContinuous -ne "True" }
# Loop through results
foreach ($Name in $jobs_Success.Name) {
# If we have results add to var
$arr_Result += $Name
$arr_Result += " "
}
# And write it out
if ($jobs_Success) {
Write-Output $StatusOk" "$arr_Result
} else {
Write-Output $StatusBad" "'No successful Jobs'
}
I have other clients where this works. Is there a way that i can see the output of the agent running that script? If i use the "Lets try" function (very practical!), i only see stuff i write explicitly to console, with write-host for ex.
However i need the error messages that must pop up. Or a suggestion for another angle of attack.... Agent runs as local system (tested running as administrator too).Thanks!