Source : http://blogs.technet.com/deploymentguys/archive/2010/03/22/mdt-debugger.aspx
When creating and configuring an LTI deployment solution there is one thing that always bugs me immensly: debugging custom scripts. Writing the scripts is easy, but debugging them is a whole different experience. The reason is simple, to debug a script you normally need to launch it from within the MDT environment (during the deployment). Consequently, it can be quite hard and very slow to iron out any errors that they (might) contain because of the need to run a full deployment of a computer, just to be able to do some testing.
This isn’t the actual part that bugs me though. The annoying part is when the script fails and MDT ends, all because of a silly mistake made in the script; this for me is the frustrating part that could at times drive me insane. Because MDT has now terminated, pretty much the only sure way to re-test the script is to re-run the deployment; vastly slowing down the debugging time.
I should point out that this is no fault of MDT, it is all mine; after all, I was the one who put the error in the script! But, because of the way MDT works, the debugging of these custom scripts can be labourious task…. until now! [cue drum-roll] I would like to present version 0.1 of the "MDT Debugger"! This nifty little tool makes debugging most custom actions, script or not, simpler and prevents MDT from terminating with the red error screen if the custom action has failed.
The MDT Debugger sits in-between MDT and your custom script and intercepts the return code that is normally sent back to MDT from your custom action. It then displays the error code and allows you to either accept and return it to MDT, edit it before returning it to MDT, or to relaunch the custom action again. This later option gives you the opportunity to fix any errors in the script/action and then relaunch it – thus eliminating the need to relaunch the deployment process from the very beginning just to re-test the custom action.
More on source :http://blogs.technet.com/deploymentguys/archive/2010/03/22/mdt-debugger.aspx