04 May 2018

MDT Not assigning the correct Drive Letter to the Windows Primary Partition with UEFI

When I installed the new MDT 6.3.8450.1000 to build the deployment package for Windows 10 1709, I ran into issues with the operating system deployment. In the process of building out the new task sequence, I also decided to convert over to UEFI. The OS was laying down, but it was installed on the wrong drive letter, D: instead of C:. After trying many things, I finally decided to abandon the Format and Partition Disk task sequence provided by Microsoft and create my own using PowerShell.

The first step of this is to create the text configuration file. I could have created the file and had the build point to it, but I would rather PowerShell do this. After researching the failed build from other issues, I found it created the following drives listed below:


  • Boot (EFI) with the drive letter W:
  • (MSR) with no designated drive letter
  • Windows (Primary) with the drive letter C:
  • Recovery (Recovery) with the drive letter E:
To achieve this, I use two task sequences in MDT as shown below,

The first task sequence consists of the PowerShell one-liner as a Run Command Line shown below. The one-liner creates the DiskpartHDD.txt file on the WinPE bootable drive (X:). The numbers I used for the sizes came from MDT. 


This is the PowerShell one-liner within the task sequence:

powershell.exe -command "&{new-item -Name X:\WINDOWS\system32\DiskpartHDD.txt -ItemType File -Force; add-content -value 'select disk 0' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'clean' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'convert gpt' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'create partition efi size=499' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'format quick fs=fat32 label=System' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'assign letter=W' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'create partition msr size=128' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'create partition primary' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'shrink minimum=50000' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'format quick fs=ntfs label=Windows' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'assign letter=C' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'create partition primary' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'format quick fs=ntfs label=WinRE' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"' -path X:\WINDOWS\system32\DiskpartHDD.txt; add-content -value 'assign letter=E' -path X:\WINDOWS\system32\DiskpartHDD.txt}"

As for the Diskpart task sequence, I used the following Run Command Line task sequence:


This is all that is required for creating the partitions. I commented out the ones provided by Microsoft and it now assigns drive C: for the Windows operating system. 

1 comments:

  1. instead of using powershell - I used a standard MSDOS redirection:

    cmd /c echo select disk 0 >> x:\windows\system32\gpt.txt & echo clean >> x:\windows\system32\gpt.txt & echo convert gpt >> X:\Windows\System32\gpt.txt & echo create partition efi size=499 >> X:\Windows\System32\gpt.txt & echo format quick fs=fat32 label=System >> X:\Windows\System32\gpt.txt & echo assign letter=W >> X:\Windows\System32\gpt.txt & echo create partition msr size=128 >> X:\Windows\System32\gpt.txt & echo create partition primary >> X:\Windows\System32\gpt.txt & echo shrink minimum=50000 >> X:\Windows\System32\gpt.txt & echo format quick fs=ntfs label=Windows >> X:\Windows\System32\gpt.txt & echo assign letter=C >> X:\Windows\System32\gpt.txt & echo create partition primary >> X:\Windows\System32\gpt.txt & echo format quick fs=ntfs label=WinRE >> X:\Windows\System32\gpt.txt & echo set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac >> X:\Windows\System32\gpt.txt & echo assign letter=E >> X:\Windows\System32\gpt.txt

    ReplyDelete