Execute Runbook MDT action doesn't return error/failed status

Greetings,

We are using the MDT "Execute Runbook" in a CM2012R2 OSD task sequence but have noticed that the task sequence is completely unaware of the exit state of the runbook.

If the Runbook completes with an error or a warning, then task sequence action always sees an exit code 0 and continues on without being aware there was a problem. Looking in the BDD and ZTIExecute logs it just shows "Final job status: Completed" and "Runbook executed successfully".

Is there a property or some other trick anyone has found for the task sequence to get the return state of an execute runbook action?

Scott.


February 20th, 2015 8:29am

Hi,

You can add a Send Email/Send Event Log Message activity to the runbook.

Free Windows Admin Tool Kit Click here and download it now
February 20th, 2015 9:59am

I don't think you've understood the question correctly.

The OSD Task Sequence is calling the runbook and I need the results of success/fail to be returned to the Task Sequence so the Task sequence itself can decide how to continue. At the moment, any runbook it launches appears to succeed no matter what actually happens.

February 20th, 2015 10:28am

Ok, I got it.

How about writing the state to MDT database then using ZTIGather.wsf to get the value.

Querying the MDT database using a custom model

http://blogs.technet.com/b/mniehaus/archive/2009/07/17/querying-the-mdt-database-using-a-custom-model.aspx

Free Windows Admin Tool Kit Click here and download it now
February 20th, 2015 12:23pm

If you tell MDT to wait for the runbook to complete, it should report a failure.  It does this by looking at the runbook status text:

If UCase(oStatus.Text) <> "COMPLETED" then
oLogging.ReportFailure "Runbook did not complete successfully, final status = " & oStatus.Text, 10806
End if


February 20th, 2015 11:35pm

I have it set to wait, but it always completes "successfully". I've tested with runbooks that I've specifically designed to fail and the runbook log shows it as failing. The MDT action just seems to be looking for the runbook completing (which is does), not the state it completed as (e.g. success,warning,fail).

I can't see what I'm missing here, as there aren't a lot of options for ways to do this.

Free Windows Admin Tool Kit Click here and download it now
February 21st, 2015 1:58am

I think we are just going to have to setup a Return Data "Fail" variable linked from every possible runbook action that could result in a warning/fail.

Then have the task sequence check if the TS Variable created has been set and act accordingly.

February 22nd, 2015 7:43pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics