If a drive is protected with BitLocker encryption, then you will need to suspend BitLocker before converting. After conversion, delete the existing protectors (PIN, Password, Certificate, etc.) and recreate them to resume encryption. If you are using third-party disk encryption, you need to work with your ISV. It’s the only sure way to determine the minimum requirements to successfully convert disk partitions without triggering a device lock or brick while keeping the drive encrypted.
How Does It Work?
Converting Within Windows
To start the conversion within Windows, open an administrative command (or PowerShell) prompt. To see the full list ofcommand line switches that can be passed to the tool, type mbr2gpt.exe /? Or mbr2gpt.exe /help.
The correct syntax to run the conversion tool within a Windows session is
mbr2gpt.exe /convert /allowFullOS
If you simply want to validate the disk (run a check without converting) then just replace the /convert switch with /validate.
mbr2gpt.exe /validate /allowFullOS
Converting Within WinPE
To convert disk layout in WinPE, use a Run Command Line action with the following syntax:
cmd.exe /c mbr2gpt.exe /convert /disk:<disknumber>
What If I’m Refreshing or Replacing the PC?
If you’re re-installing Windows to the current disk, or if you’re replacing the drive or computer, you will not be using the MBR2GPT.exe tool. If the system is booted in UEFI mode before the Format and Partition Disk step happens in the Install Operating System group, the Task Sequence engine will happily format the disk for GPT. If you have created a sequence that restores user data, it will still be able to be restored.
What Are the Limitations?
The first and perhaps most important limitation is that MBR2GPT.exe is not the same thing as “BIOS to UEFI”. MBR2GPT.exe is a tool to convert partition layout while BIOS to UEFI is the process of converting a system’s firmware mode from BIOS to UEFI.
While MBR2GPT.exe can be run from the full OS, or in WinPE, it should be run before the conversion of BIOS to UEFI during an in-place upgrade and most preferably in WinPE. If the tool is run after the firmware mode is converted, and for some reason is unsuccessful with the conversion, the device will essentially be bricked until the PC is manually converted back to BIOS mode.
If you are performing a PC refresh or replace, the PC should be converted before the “Format and Partition Disk” step runs in the Install Operating System Group. It is possible to do this later in the sequence, but this route is more reliable. This is because this group has two Format and Partition actions with variables on them that read whether the PC is in BIOS mode or UEFI mode and formats and partitions the disk accordingly. As you can see below, the image on the left depicts what the Task Sequence engine will do to the disk if the PC is running in BIOS mode, and the image on the right shows what it will do to the disk if it is in UEFI mode. The most important takeaway is that BIOS mode means the disk will be formatted in MBR layout and UEFI means it will be formatted in GPT layout.
Legacy versions of Windows aren’t officially supported. If you successfully convert the partition type into GPT layout, you’ve stepped out of the realm of support. Typically, “not officially supported” means it can likely be done, but it isn’t well tested internally, so you’re on your own if something goes wrong or if you have questions. It would be better to upgrade the system to a version of Windows that is supported.
Once the disk layout has been converted, you cannot undo it. Furthermore, if the layout was performed during an in-place upgrade, you will not be able to go back to a previous version of Windows. I was able to test and validate this limitation in all three major PC vendors (Dell, Lenovo, HP).
To use the tool, the disk to be converted needs to have less than four partitions (meaning three partitions is the maximum). In testing the conversion tool, it was noted that Dell models create an extra recovery partition during an in-place upgrade which can cause the conversion tool to fail if you hit the limit of partitions before the upgrade runs. To get around this, I deleted all recovery partitions leaving the PC with only two partitions. During the in-place upgrade, the Dell PC created a third partition (as expected) which didn’t cause the conversion tool to fail. The HP and Lenovo models I tested did not create extra partitions during the in-place Upgrade.
If you are going to use one sequence to handle all hardware models, ensure that you are supplying the correct driver package for the model running the upgrade and that the engine can read and process the variable. If the variable you set on your driver package is incorrect, setup.exe will not use it. While the discussion about why you need to provide driver packages during an in-place upgrade is a bit off topic, it is important to note. It matters because some of the vendor models that I tested failed the MBR2GPT.exe conversion later in the in-place upgrade when I did not also provide driver packages to them. This may not be true for every vendor model, but happened consistently enough in my testing that to be deemed important to take note of.
How Do I Check What Partition Type My Disks Are Using?
Open an administrative command prompt and type the following:
select disk <disk number>
sel part <partition number>
If the disk is using MBR partition type, it will display 07 for the type in the detail part command as pictured below on this Windows 7 PC.
Any disk with an asterisk under GPT in the table is in GPT layout as pictured on this Windows 10 PC.
When the MBR2GPT.exe tool is run, it creates four logs in the %windir% directory (C:\Windows). The four logs are setuperr.log, setupact.log, diagerr.xml, and diagwrn.xml with setuperr.log having the most detailed information. In the example below, I ran the tool and saw in setuperr.log that it failed because there are too many partitions.
A full list of error codes for the tool can be found on TechNet under the Return Codes section here docs.microsoft.com. Note that these error codes are specific to the tool itself and shouldn’t be confused with error codes that the Windows 10 setup or the Task Sequence engine may throw.
If you would like readymade sequences that handle both MBR2GPT.exe and BIOS to UEFI for both PC refresh/replace and in-place upgrade scenarios, we have created a document that walks through the setup of both scenarios on Adaptiva’s SCCM Academy. The Secure 10: BIOS to UEFI 2017 Update solution is free, and includes two Task Sequences that can be imported into your environment. It’s up to you to provide all the dependencies (1703 Boot Image, Vendor Tools for BIOS to UEFI, etc.). However, these are working sequences that I have run against all three vendors in our lab, and could save you days of works. Happy migrating!