Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a MDT server that needs to run a script. This script is potentially problematic and sometimes errors out with an access denied to a network resource.

It looks like I can handle this with the 'continue on error' option to move on to the next step.

I would like to manipulate the current step attribute in some fashion if this failure occurs to rerun the previous step, effectively rerunning my problematic script.

How can I do so? My guess would be to set a variable back to the desired step name but I'm not sure the exact logic to do so, if there is anything available to see the status of the last step executed, etc. The documentation I've looked at has been lacking.

Any suggestions?

share|improve this question
up vote 1 down vote accepted

In SCCM, when a task sequence action fails, the variable _SMSTSLastActionSucceeded is set to false.

You can add a step immediately after the step that runs your script and set it to only run when _SMSTSLastActionSucceeded is false.

This will give the task sequence two chances to run your script. If you want the task sequence to keep trying the script until it succeeds, I'm sorry, I don't know how to do that.

Here is the list of task sequence variables.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.