Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


rloesche
2016-04-01T09:30:30Z
Hello
we have a powershell task that makes a web service request. We have set the error handling so that a return code of 0 is success. Still VC tells us that the task success = failure allthough the returncode is 0. The result from the web service call is also ok. So from our perspective everything works fine :(
Find below the output and also the powershell script we run.

Our VC version is 8.0.2
Windows 2012
Powershell:

PS D:\VC_utilities> $PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.34014
BuildVersion 6.3.9600.17400
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2


OnErrorSettings:
AllErrors
Raise Error if ErrorOutput != 0

Output (error) = 0
Output ===========================================================
11:13:03: Server->Execute path: C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe
11:13:03: Server->Executing Task process
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->CreateService->Response channel created on address: /TaskProcess/8809636
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Requesting Task information
11:13:03: Server->Sending Task information
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Task information sent
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Task information received
11:13:03: Server->Task information sent
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before PowerShell execution
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: VisualCronAPI, Version=1.0.3.32414, Culture=neutral, PublicKeyToken=55f7a52402de1c04
11:13:03: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before runspace.CreateRunspace
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: Microsoft.PowerShell.Commands.Diagnostics, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: Microsoft.PowerShell.ConsoleHost, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: Microsoft.PowerShell.Commands.Management, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: Microsoft.PowerShell.Security, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: Microsoft.WSMan.Management, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before runspace.ThreadOptions
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before runspace.Open
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Success opening Runspace(1): UseCurrentThread
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before runspace.CreatePipeline
11:13:04: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before runspace.Invoke
11:13:05: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
11:13:05: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Assembly loaded: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
11:13:07: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before runspace.Close
11:13:07: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before result loop
11:13:07: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Before rError.ReadToEnd
11:13:07: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Preparing Task log
11:13:07: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Sending result
11:13:07: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 8809636)->Result sent
11:13:07: Server->Executing Task process exited with exit code: 0
11:13:07: Server->Waiting for completion and result
11:13:07: Server->Task result received, success: False
MBean Check for VMP + WTC
http://x-m1system1:10080/jolokia-war-1.3.1/read/de.directline.wtc.mbeans:name=HealthCheckMBean
http://x-m1system1:10080/jolokia-war-1.3.1/read/de.directline.vmp.mbeans:name=HealthCheckMBean


InxMailIsOk : OK
DatabaseIsOk : OK
Version : 4.1.503
PrintIsOk : OK
RatingIsOk : OK

DatabaseIsOk : OK
Version : 4.1.464
PrintIsOk : OK
RatingIsOk : OK
=================================================================



The powershell script is:

param(
[string]$server
)

$url = "http://${server}:10080/jolokia-war-1.3.1"
$mbeanvmp = 'de.directline.vmp.mbeans:name=HealthCheckMBean'
$mbeanwtc = 'de.directline.wtc.mbeans:name=HealthCheckMBean'

$action = 'read'

$wtc = "$url/$action/$mbeanwtc"
$vmp = "$url/$action/$mbeanvmp"
$res1 = 0
$res2 = 0

write-output -InputObject 'MBean Check for VMP + WTC'
write-output -InputObject $wtc
write-output -InputObject $vmp

try{
$resp1 = Invoke-RestMethod -Uri $wtc -Method Get
write-output -InputObject $resp1.value
if( $resp1.value.DatabaseIsOk -and $resp1.value.PrintIsOk -and $resp1.value.RatingIsOk ){
$res1 = 0
}

$resp2 = Invoke-RestMethod -Uri $vmp -Method Get
write-output -InputObject $resp2.value
if( $resp2.value.DatabaseIsOk -and $resp2.value.PrintIsOk -and $resp2.value.RatingIsOk ){
$res2 = 0
}


} catch {

write-error 20
}

write-error ( $res1 + $res2 )
-------------------------------------------------------------------------------------------------------------------
Sponsor
Forum information
Support
2016-04-01T09:38:00Z
Thanks for the report! Can you please test this with the latest version of VisualCron?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
bbusse
2016-04-01T13:29:31Z
Write-Error 0 will ALWAYS be treated as an error, you're literally telling it there was an error. You need to use EXIT 0
2016-04-01_8-36-42.png
Brian
rloesche
2016-04-04T19:14:03Z
Hi Hendrik

we tested with 8.0.4 - works as advertised. Consider it done - we will upgrade.

kind regards

ralf



Support
2016-04-04T19:56:49Z
Thanks for the feedback!
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
bbusse
2016-04-05T00:30:36Z
What did I miss here? Write-Error 0 will return an error with a resulting output of 0 (zero).

What exactly was fixed?

Brian
Support
2016-04-05T06:32:51Z
Originally Posted by: bbusse 

What did I miss here? Write-Error 0 will return an error with a resulting output of 0 (zero).

What exactly was fixed?

Brian



Even though execution was success we could return failure from the Task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top