Strange Error from Commandline Task in MDT, diskpart, keep data partition after new deployment

Occasional Contributor

Update:

 

This video actually describes how to do reformating of a OS Disk only, but there is one option missing in the "Install Operating System" Task in the MDT 6.3.8443.1000. The picture show, probably an older version of MDT

 

During Refresh scenarios, install to original Disk and PartitionDuring Refresh scenarios, install to original Disk and Partition

This is MDT 6.3.8443.1000:

 

Option-Missing.png

 

Maybe this is why it is not working for me?

 

Original Post: 

I try to deploy a windows 10 on a disk with two partitions using Server 2012 and MDT 6.3.8443.1000

This is a MBR disk, with one OS and one data partition. I would like to keep the data partition while I would like to reinstall the OS.

 

My task sequence contains a command line task in Preinstallation that does the following:

 

diskpart /s "%SCRIPTROOT%\DiskpartOnlyFormatC.txt"

 

DiskpartOnlyFormatC.txt contains this:

 

SELECT disk 0
Select partition 1
FORMAT FS=NTFS QUICK
ACTIVE
EXIT

 

My suspicion is that WDS writes Data to the partition that I am actually formatting and this leads to the problem, but I am not sure. The question would be if there is another way of doing this? There is a partitoning task, but it does not allow to keep existing partitions alive.  The reason for doing this is obvious, we have 1000ands of computers with a data partition, which is backed up, but they can be quite big and restoring from backup would take very long.

 

This is what is in the logs:

 

Failed to run the last action: Format OS Partition only. Execution of task sequence failed.
Unknown error (Error: 80042413; Source: Unknown) TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Executing in non SMS standalone mode. Ignoring send a task execution status message request TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Task Sequence Engine failed! Code: enExecutionFail TSManager 15.06.2017 14:12:20 1476 (0x05C4)
**************************************************************************** TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Task sequence execution failed with error code 80004005 TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Cleaning Up. TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Removing Authenticator TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Cleaning up task sequence folder TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Unable to delete file C:\_SMSTaskSequence\TSEnv.dat (0x80070005). Continuing. TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Failed to delete directory 'C:\_SMSTaskSequence' TSManager 15.06.2017 14:12:20 1476 (0x05C4)
SetNamedSecurityInfo() failed. TSManager 15.06.2017 14:12:20 1476 (0x05C4)
SetObjectOwner() failed. 0x80070005. TSManager 15.06.2017 14:12:20 1476 (0x05C4)
RemoveFile() failed for C:\_SMSTaskSequence\TSEnv.dat. 0x80070005. TSManager 15.06.2017 14:12:20 1476 (0x05C4)
RemoveDirectoryW failed (0x80070091) for C:\_SMSTaskSequence TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Deleting volume ID file C:\_SMSTSVolumeID.7159644d-f741-45d5-ab29-0ad8aa4771ca ... TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Deleting volume ID file D:\_SMSTSVolumeID.7159644d-f741-45d5-ab29-0ad8aa4771ca ... TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Successfully unregistered Task Sequencing Environment COM Interface. TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Executing command line: "X:\Deploy\Tools\X64\TsProgressUI.exe" /Unregister TSManager 15.06.2017 14:12:20 1476 (0x05C4)
==========[ TsProgressUI started in process 1848 ]========== TsProgressUI 15.06.2017 14:12:20 1832 (0x0728)
Unregistering COM classes TsProgressUI 15.06.2017 14:12:20 1832 (0x0728)
Shutdown complete. TsProgressUI 15.06.2017 14:12:20 1832 (0x0728)
Process completed with exit code 0 TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Successfully unregistered TS Progress UI. TSManager 15.06.2017 14:12:20 1476 (0x05C4)
RegQueryValueExW is unsuccessful for Software\Microsoft\SMS\Task Sequence, SMSTSEndProgram TSManager 15.06.2017 14:12:20 1476 (0x05C4)
GetTsRegValue() is unsuccessful. 0x80070002. TSManager 15.06.2017 14:12:20 1476 (0x05C4)
End program: TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Error Task Sequence Manager failed to execute task sequence. Code 0x80004005 TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Sending error status message TSManager 15.06.2017 14:12:20 1476 (0x05C4)
In non SMS staqndalone mode.Ignoring SendStatusMessage request TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Finalizing logs to root of first available drive TSManager 15.06.2017 14:12:20 1476 (0x05C4)
LOGGING: Setting log directory to "D:\SMSTSLog". TSManager 15.06.2017 14:12:20 1476 (0x05C4)
Process completed with exit code 2147500037 TSMBootstrap 15.06.2017 14:12:20 1092 (0x0444)
Exiting with return code 0x80004005 TSMBootstrap 15.06.2017 14:12:20 1092 (0x0444)
Used smsts.ini to set logging settings. TsProgressUI 15.06.2017 14:12:20 1856 (0x0740)
==========[ TsProgressUI started in process 1212 ]========== TsProgressUI 15.06.2017 14:12:20 1856 (0x0740)
Unregistering COM classes TsProgressUI 15.06.2017 14:12:20 1856 (0x0740)
Shutdown complete. TsProgressUI 15.06.2017 14:12:20 1856 (0x0740)

 

1 Reply

Reminder to the actual problem:

 

This then led to my task finally doing what it is supposed to. The goal was to have a Windows 10 on a Windows 7 machine that has a large data partition without having to restore the the data partition after deployment. With a large number of machines this would be lots of wasted time.

 

The solution to this was found by paying Microsoft, however for others who run into such a problem, here the solution.

 

The Problem had to do with the fact the file that contained the diskpart command must have been on the partition that was formatted. If not that file then at least some information needed to finish the step inside the task sequence. This led I believe led to the error. I find that often with Microsoft products it is more believe than knowledge, as sometimes it is simply impossible to figure out what actually happened.

 

However, this is how the formatting issue was solved. Add the directory to the WinPE and then execute the diskpart command with the file that is actually on the X: partition:

 

image.pngimage.png

 

To make sure the disk formatting tasks are not executed one has to set a variable: DoNotFormatAndPartition

 

image.png

 

Then update the image and things SHOULD work. With Microsoft this is always a SHOULD.