How-to Convert Windows 10/2016+ Build 1703 or later VSS VM from BIOS to UEFI

Information Security recommends having your Windows VMs with Virtualization Based Security (VBS) and Virtual Trusted Platform Module (vTPM) enabled.

This how-to was contributed by Joe B. from the Architecture team at Information Security, ITS and edited and adapted by the ITS Private Cloud Team.

Prerequisites

The process cannot be performed for versions prior to Windows 10/2016 (or some early Windows 10 versions), as they are End-Of-Life (EOL) and are no longer licensed or viable for use in the environment, without valid Extended Security Updates (ESU).

Windows 10/2016+ Operating System.
Ensure C: Drive has a least 5GB of free space.
Server administrator rights.
ITS Private Cloud Command-Line Interface access.

 Instructions

Preparing the VM

  1. Verify if the virtual machine in question has any of the required security features:

    vss-cli --columns name,uuid,domain.name,version,vbs_enabled,firmware,tpm compute vm ls -f name=UTSGDEV-TEST name uuid domain.name version vbs_enabled firmware tpm -------------------- ------------------------------------ ------------- --------- ------------- ---------- ----- 1812D-UTSGDEV-TEST {{uuid}} FD1 vmx-19 False bios []
  2. Take a virtual machine snapshot. More details Manage virtual machine snapshots

    vss-cli compute vm set {vm-id} snapshot mk --description 'Before hardening OS' --lifetime 4

Note that Operating System changes cannot be undone. Reverting to previous snapshot is the ONLY way to recover should something go wrong. But there also no need to keep the snapshot for any extended period. (i.e. --lifetime 4)

Converting the OS from BIOS to EFI

  1. VSS Console (or RDP) in the VM and open a Privileged Command Prompt (NOT PowerShell).

  2. Validating before Converting

    mbr2gpt /validate /allowFullOS
  3. Assuming you are converting the system disk

    mbr2gpt /convert /allowFullOS
    1. Successful migration:

       

    2. if you have a non-standard install you may specify the Disk # this the system and boot disk:

      mbr2gpt /convert /disk:0 /allowFullOS

If you get an ERROR, revert to previous snapshot.

Converting the VM from BIOS to EFI

  1. Shutdown the Virtual Machine

    vss-cli --wait compute vm set {{uuid}} state -c shutdown
  2. Enable VBS on the Virtual Machine

    vss-cli --wait compute vm set {{uuid}} vbs on
  3. Validate the VBS Change

    vss-cli --columns name,uuid,domain.name,version,vbs_enabled,firmware,'tpm[*].label' compute vm ls -f name=UTSGDEV-RD name uuid domain.name version vbs_enabled firmware tpm[*].label -------------------- ------------------------------------ ------------- --------- ------------- ---------- -------------- 1812D-UTSGDEV-RD-GW1 {{uuid}} FD1 vmx-15 True efi Virtual TPM

Note that you should see vbs_enabled set to True, firmware to efi and a Virtual TPM in the tpm column.

  1. Startup the Virtual Machine

    vss-cli --wait compute vm set {{uuid}} state on

Validate Operating System and Server Operation

Validate VBS and TPM

  1. From a privileged PowerShell session run the following command to verify the UEFI partition information.

    Get-WmiObject -query 'Select Type from Win32_DiskPartition Where Type = "GPT: System"'
  2. From a privileged PowerShell session run the following command to verify the TPM information:

    Get-WmiObject -Namespace "Root\CIMV2\Security\MicrosoftTpm" -query "Select * from Win32_Tpm"

Hide System Reserved Partition

As part of the MBR2GPT conversion the “System Reserved” partition is temporarily assigned “E:”, but is not automatically rehidden after completion.

  1. Press W+R to bring up the run window.

  2. Type diskmgmt.msc and press Enter, which will open Disk Management.

  3. Right-click on the target System Reserved partition and choose the "Change drive letter and paths" button.

  4. Click on Remove in order to remove the assigned drive letter, and then click Yes as the warning window appears. This picture below sets E drive as an example:

    hide a partition via disk management
  5. Now, you can click open File Explorer and check if the System Reserved partition has been hidden.

Apply Credential Guard GPO or Local Security Settings

Virtual Machine Snapshot Cleanup

After you have verified your Operating System functions as expected, a snapshot deletion is due, and to do so, you have two options.

  1. Remove the snapshot manually:

    vss-cli compute vm set {vm-id} snapshot rm {snapshot-id}
  2. Wait until expires.

If you set to manual disk consolidation, please follow Manage virtual machine snapshots to run disk consolidation.

 

 Related articles

Related content

University of Toronto - Since 1827