No body ?
have you tried return 1 instead of exit(1)?
I just did.
It is the same :
the return code of the task is 0 (all went well)
I understand that the script was well deployed and executed. But Landesk doesn't take the return code of the program and this is strange for me.
And it would be so convenient ....
I'm not very familiar with PS scripts (I work with AutoIT/Batches), but it seems it's working in a different way you (we) thought. Take a look here:
I will study that.
Firstly : Thank's for the links.
Secondly, it is not resolved.
I really can not take the error level from a Powershell package.
I tried evry method on the links and none works.
If you ever tried and deployed a powershell package, did it work for you ?
I haven't tried it. I used batches and in the meantime AutoIT..
Could you attach/show your PS script?
I do'nt have any script yet.
It's just for using powershel wich is very powerfull instead of standart batch.
(and we have a scriptin guy wich is happyer with powershell)
I am charged of makling a fonctional powershell packet, and if possible to return the error level of the powershell script on landesk.
My scripts are like :
$exit = 1
And much more.
I know this is over a year old, but did you ever find a solution? I just ran into the exact same problem, my issue is that I'm just trying to get some information via the return code....
It is a known issue... when called to run a script, PS calls the script asynchronously so the Return Code 0 means "I launched the script successfully" and doesn't wait for the script to finish. I have opened a ticket for this in the past, #00633377
Wow that was a quick response, thanks! I just figured out how to make it work though... Try using this in your script
This is a pretty bad issue and should be fixed.
Even if you execute a powershell script that doesn't exist, it says it was successful.
The powershell script requires error handling. Please add the following at the end of your script:
if ($? -ne $true)