Auto Removal of MDT State Folders

When you're building and testing MDT deployments as often as I do, you appreciate scripting and automation. Often times, I'm wiping and kicking off deployments within WinPE. You hit go, wait awhile and then you find something that needs to be modified either in the image or part of the task sequence. You make the change in MDT and...

You need to retest.

So you restart the PC (or VM in many of my scenarios) and boot back into WinPE. You expect to find the Welcome to Windows Deployment wizard but instead you find an error message indicating that the installation cannot continue due to the fact that it is in WinPE. What is happening?

In order to maintain deployment state across reboots, the task sequencer writes variables and logs in two specific locations: %SYSTEMDRIVE%\_SMSTSequence and also %SYSTEMDRIVE%\MININT. When WinPE boots, it looks in these locations to see if there is any information it needs. Problem is, most of the time when you're entering into WinPE you're there to wipe and reload the OS, not to continue OS installation. What needs to happen, in the words of Johan Arwidmark is to "get rid of the junk".

What we want to do is remove these folders before the Deployment Wizard discovers them and throws an error. You can add a command script to the Unattend.xml of WinPE inside the RunSynchonous element. The command script would perform something like this:

If Exist C:\MININT\nul rd C:\MININT /s /q
If Exist C:\_SMSTaskSequence\nul rd C:\_SMSTaskSequence /s /q

Check out the reference below to read more about this and also check out Johan's other blog post's at He has some great content.