How do I enable debug mode in MDT?

Applies to: Microsoft Deployment Toolkit (MDT) 8456 and later
Last updated: May 2025


Problem

You want to run MDT deployments in debug mode to troubleshoot issues, monitor variables, or pause at key stages for analysis.


Solution

MDT supports multiple methods for enabling debug mode, including pausing the Task Sequence, enabling trace/logging tools, and manually launching scripts in debug-friendly configurations.


Option 1: Add a Pause Step in the Task Sequence

You can manually pause the Task Sequence using a script to stop execution and allow interaction.

Step 1: Create the Pause Script

Create a script called Pause.vbs in your Scripts folder:

MsgBox "Deployment paused for debugging. Click OK to continue.", vbSystemModal, "MDT Debug Mode"

Step 2: Add to the Task Sequence

  • Open the Task Sequence > Task Sequence tab
  • Click Add > General > Run Command Line
  • Command line: cscript.exe "%SCRIPTROOT%\Pause.vbs"
  • Place this step after the part you want to inspect (e.g., after driver injection or disk formatting)

Option 2: Enable Variable Debug Logging

Set the SLShareDynamicLogging variable in CustomSettings.ini to send logs to a shared folder:

[Default]
SLShareDynamicLogging=\\MDT01\Logs$

This allows real-time log review during deployment.

Make sure the share is writable and accessible from WinPE.


Option 3: Monitor Variables with ZTIGather

Run ZTIGather.wsf manually in WinPE to view all current variables:

cscript.exe X:\Deploy\Scripts\ZTIGather.wsf /debug:true
  • Logs: ZTIGather.log
  • Output shows all environment variables that MDT uses, useful for debugging rule logic

Option 4: Use MDT Monitoring (GUI Debugging)

Enable Monitoring in Deployment Workbench:

  • Right-click Deployment Share > Properties
  • Go to Monitoring tab > Enable monitoring

This shows live deployment progress, current Task Sequence step, and any failed or pending operations.


Option 5: Use Set Variables Step for Inspection

Add a “Set Task Sequence Variable” step in your Task Sequence to temporarily override values for testing:

  • Name: OSDComputerName
  • Value: DEBUG-MACHINE

You can inspect the impact in logs like ZTIGather.log or final deployment results.


Notes

  • Avoid leaving pause steps in production Task Sequences.
  • Always test debug changes in a lab environment or virtual machine.
  • Logs are stored temporarily in:
    • X:\MININT\SMSOSD\OSDLOGS\ (WinPE)
    • C:\MININT\SMSOSD\OSDLOGS\ (Post-OS)

You may also like...