Usually, when we run PS scripts using the scripting module, the only output we gety in the output logs is a status message saying that the PS script was successfully launched. Unfortunately, this does not let us know if the script itself ran without issue.

Is there anyway to have a script send back an exit code or status massage to the output logs so that I can tell if the script itself encountered issues?

Any help would be greatly appreciated.

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0

You could have the script write a txt file on each PC which you could then pull into inventory in a custom inventory rule.

Answered 05/29/2014 by: KHaught
Senior Yellow Belt

Please log in to comment
0

What does the script do. You can create custom rules to look for a certain change, whether it is a reistry key creation or modification, or a dir or file creation or time stamp change.  I usually set that same change as a validator for the script so it does not run over and over again on a machine.

Answered 05/29/2014 by: SMal.tmcc
Red Belt

Please log in to comment
0

We use PS and KACE a lot of roll out software, make configuration changes to files, etc. etc.

What I was hoping was that I could throw unexpected exceptions back to the output log during the script run so that when something failed to get the change or software I'd have an idea of why without having to log into machines locally and run the script to see what condition caused it to fail.

I already know how to tell is a change was successful, but I was hoping I could get information saying why it failed, which is more than knowing that it failed.

I can grab exceptions with a try/catch block but I wanted to pass the exception information back up the stack to KACE at the end of the run.

Answered 05/29/2014 by: ndelo
Senior White Belt

Please log in to comment
0

If you had a specific error code, you could specify it with an exit statement, for example if you just wanted to exit with an error code of 1 you would use:

exit 1

This is assuming the K1000 will pay attention to that error code and log it when it runs the script.  I have not tested this so I can't answer that part.

You could also, as was already mentioned, write to a log file.  You should be able upload the log as the last step in the script, so you wouldn't need a custom inventory for it.

Answered 05/29/2014 by: ncsutmf
Second Degree Green Belt

Please log in to comment
0

I guess that's exactly what I am asking, will KACE record the exit codes from a script run via the agent.

Answered 05/29/2014 by: ndelo
Senior White Belt

Please log in to comment
Answer this question or Comment on this question for clarity