Then you need to add a little bit debug output to your script file to see what the problem is.
If your script works correctly you have only two possible outcomes.
- Inside the agent output you see your expected output
- Inside the agent output you get an error message with some useful information
I think the problem is that you executable called from the script is not found if it runs from the agent as local system. This would be the only explanation i can think off.