Have KACE Online shell script (Powershell) return failed
I am running a PowerShell script using a KACE shell script. I would like to check for a condition and if the condition is true do something, else throw an error. When the error is thrown I would like for it to report in KACE in the run now section as failed. Right now it always reports as a success just telling me that the script was able to execute. Is there a way for me to throw an error from PowerShell that Kace will interpret as a failed run? I am able to do this in an online Kscript by using 'exit 1' in the PS script which Kace sees as failed, but it doesn't seem to work for the shell script.
Answers (1)
If I am understanding correctly, you are seeing the "reports as successful" from the "run now status" screen. This is sometimes confusing as unless the script could not run (ie. computer offline, or could not find the script or something) it will always report successful in that screen because technically it ran.
If I am correct in thinking this is what you are talking about, have you looked at the log for the information you are after? You get to it by clicking on the job time in the "run now status" screen after it is successful and expanding the "successful execution" section and clicking on the" view logs" next to the device you wish to see more about. Any output you have configured should show there.