Currently there is no way of a script to talk back to the workflow that started it which means any error's and also emails have to be done via the script instead of the workflow (emails need to be in case there are some errors causing the work not to be completed). This idea is to allow a script to communicate back to the workflow to let it know when the script is completed or if there is an error, and maybe pass back information back to the workflow to be used.
One way to facilitate this could be to have a new task option which is sort of a delay which will also wait to receive one of two emails a successful one and an unsuccessful one which you could then route sort of like an approval depending on which one was received. The delay part of this would allow us to then say wait for 1 hour (for example) for one of the emails and if none received go down the unsuccessful route.
We have a couple of different ways of doing this - happy to talk further if you want to drop me a line at david.mckinney@lida.com.au.
We Use the API the bring back information to the request. We also use Conditional Branches how to deal with the outcome of the information from the powershell scripts our other API systems.