Hi,
Thanks for posting in Microsoft Q&A forum.
1, If the MDT deployment was forced to restart by an application install, or other means outside of the task sequence. You need to find which application is causing the restart and suppress it. If you are able to find and suppress the application, and it is necessary to do a reboot, you can right-click the application in the Deployment Workbench console, go to properties, and under the details tab you will see a reboot the computer after install checkbox.
Refer to: Dirty Environment error.
You may try to add a No Restart parameter to your application. This parameter can be found with the Ultimate EXE Silent Switch Finder
Note: This is non-Microsoft link, just for your reference.
2, You can also try to use Diskpart command to clean up your hard drive. Refer to:
MDT 2013 - Dirty Environment Found Pop Up
Best regards,
Simon
If the response is helpful, please click "Accept Answer" and upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.