Powershell execution problem

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
Pablo Rönnebarth
Posts: 12
Joined: Fri Feb 28, 2014 10:05 am

Powershell execution problem

Post by Pablo Rönnebarth »

Hi :)
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'
}
If i execute that on the server it runs perfectly. Executionpolicy is unrestricted. HM 9.90. It used to work until about 2 weeks ago. The agent and HM are running on server 2012.
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!
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

What exactly is the problem?
Script executed by RMA agent returns unexpected result? "Bad" instead of expected "Ok" status? "Ok" instead of "Bad"?
Script is not started?
something else?

HostMonitor version?
RMA version?
Test status? Reply?
However i need the error messages that must pop up.
Popup? Tests should not show any popup windows, tests should return status and reply value to HostMonitor. That's it.
If 1000 tests will show popup windows, it would be a mess...

Regards
Alex
Post Reply