Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Hard disk cleanup within a Microsoft Deployment Toolkit-based deployment (WinPE) (open source)

Mai 2022

UI-based application to erase the primary hard disk as part of a Lite Touch installation.

cleanup-social-media-logo

A clean way to wipe the hard disk before starting the Lite Touch-based Installation

Cleanup is a Win32 application created in (Microsoft) C and Visual Studio 2010. The small program solves the problem mentioned in the headline in a somewhat nicer way than the otherwise available and purely script-based solutions on the Internet.

The project is hosted on GitHub: Cleanup

cleanup-application-animated-gif

All starts as usual - with a problem

In an MDT project to deploy an offline-based Windows 10 installation, I noticed that it sometimes terminates with an error. This happened somewhere in the task sequence after the step: “Format and partition disk (BIOS) / … (UEF)”, so relatively early, at the beginning of the installation process.

I was able to trace this back to a hard disk that had not been cleaned (I also found some posts on the Internet that pointed to the problem).

The solution to the problem was also relatively simple: I didn’t have to do anything more than run the Diskpart tool in a CMD shell to wipe the primary hard disk before starting the actual installation.

diskpart.exe
sel dis 0
clean
exit

An alternative to a purely script-based solution: Cleanup

In the long run, however, I did not like the manual solution and so an additional step in the task sequence was supposed to solve the problem for me. However, it quickly turns out that this was not so easy in the MDT because I needed to reboot the system after cleaning up the hard disk and so the task sequence would run over and over again (there may be a solution for this too - but I don’t know it).

I found out that you can run a simple Visual Basic script with this task before running the actual installation. That was the solution!

However, since I wanted to make the script a little more pleasant (nicer), I had to come up with a GUI-based solution: cleanup.

Source code & compiled release files

You can find the MIT-licensed project on my GitHub. Both the current compiled version and the associated project files can be downloaded from the GitHub repository: click here (external)

Have fun and success with it.