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


dmk
  •  dmk
  • No customer Topic Starter
2016-01-21T15:15:41Z
A PowerShell task will succeed even if the script exits non-zero. We are using 8.0.1 (both client and server). I have attached the XML for a trivial test job that demonstrates the problem.

  PowerShell text.txt (8kb) downloaded 44 time(s).
Sponsor
Forum information
Support
2016-01-21T22:06:25Z
We will look in to this and get back to you ASAP.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2016-01-26T16:40:44Z
This bug has now been fixed here:

http://www.visualcron.co....aspx?g=posts&t=5431 

Thanks for the report!
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
dmk
  •  dmk
  • No customer Topic Starter
2016-02-10T16:09:46Z
I just tested 8.0.2 (pursuant to another bug I reported). The PowerShell exit problem does not appear to be fixed. The test job I attached above still reports success even though the PowerShell script exits 3.
Support
2016-02-24T10:11:40Z
Upon further investigation the fix was there to support "throw" command. We execute PowerShell internally through RunSpaces and there is no such thing as "exit codes" there. Processes return exit codes. See reference here:

http://stackoverflow.com...ll-exit-code-via-c-sharp 
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
dmk
  •  dmk
  • No customer Topic Starter
2016-02-24T15:32:42Z
I recommend removing the "Non zero exit code" option from PowerShell's "Error causes" list, since it doesn't work.

I've also noticed that when I throw an exception, the task's Output contains what look like debugging messages instead of whatever output the script wrote. For example, try the following script:

echo "hello world"
throw "bye"

I'd expect to see "hello world" in the Output, but all that's there is stuff like this....

09:30:43: Server->Execute path: C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe
09:30:43: Server->Executing Task process
09:30:43: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 371)->Assembly loaded: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
. . .
Support
2016-02-25T13:01:36Z
If you want to see Hello world you should use:

write-output "Hello world" and it will go to output column.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
dmk
  •  dmk
  • No customer Topic Starter
2016-02-25T14:51:15Z
write-output "hello world" does not cause "hello world" to appear in the output.

Here is the script:

write-output "hello world"
throw "bye"

Here is the Output (error):

ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->System.Management.Automation.RuntimeException: bye ---> System.Management.Automation.RuntimeException: bye
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at TaskPowerShell.PowerShellTaskClass.Run(ProcessPowerShellTaskInfoClass ti, StringBuilder& sbStandardOut, StringBuilder& sbStandardError, Boolean& bolResult)

Here is the Output:

08:40:21: Server->Execute path: C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe
08:40:21: Server->Executing Task process
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Assembly loaded: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Assembly loaded: System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Assembly loaded: System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->CreateService->Response channel created on address: /TaskProcess/376
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Requesting Task information
08:40:21: Server->Sending Task information
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Task information sent
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Task information received
08:40:21: Server->Task information sent
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Before PowerShell execution
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Assembly loaded: VisualCronAPI, Version=1.0.3.32953, Culture=neutral, PublicKeyToken=55f7a52402de1c04
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Before runspace.CreateRunspace
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 376)->Assembly loaded: Microsoft.PowerShell.Commands.Diagnostics, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
08:40:21: ExecuteProcess("C:\Program Files (x86)\VisualCron\\TaskPowerShell.exe" 3

I have attached the XML for the job:

  Jobs.txt (11kb) downloaded 28 time(s).

Note that if I remove the throw, then "hello world" does appear in the Output (and all those timestamped lines do not).
Support
2016-02-26T12:54:36Z
Yes, my bad. No, output will never be available if a throw is called. The reason is that the Invoke method returns the output. But the Invoke method fails when throwing so there will be no output.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top