How to Create VHD of Windows 10 Installation and Use in Hyper-V

Note
The tutorial has been updated today (20-MAR-2017). Please post all your questions about this process in this thread.
Please notice: some screenshots are from pre-release builds of Windows 10. Disk2VHD runs without any issues on and can create a VHD from any consumer and server version of Windows starting from Windows XP and Windows Server 2003.

Information
Disk2VHD is a practical free tool by
Sysinternals, since 2006 a subsidiary of Microsoft Corporation. Sysinternals is well known of their wide range of free tools to manage, troubleshoot and diagnose Windows systems and applications. As the name already tells
Disk2VHD is a tool to create a
Virtual Hard Disk (VHD) file of an existing Windows system. This VHDfile can then be used to create a virtual machine in
Windows Virtual PC (Windows 7) and
Hyper-V (Windows 8 and later).
In this tutorial we will download and install
Disk2VHD on an existing
Windows 10 computer, use it to create a VHD of the current Windows 10 installation on that computer and use the resulting VHD to create a virtual machine on Windows 10 Hyper-V. The virtual machine will be an exact copy of the original Windows installation apart of some hardware and drivers, Hyper-V replacing some hardware with its own virtual devices.
The virtual machine will be fully functional and contain all software, user profiles and settings which were installed and present on the real physical computer and Windows when the VHD creation process was started.
Contents:
Use links above to jump to any part of the tutorial. Click screenshots to pop out, click again to expand.
1.1) First, download and install
Disk2VHD, a tool by Mark Russinovich at
Windows Sysinternals:
Download
1.2) Extract downloaded
Disk2VHD.zip to a folder, run
Disk2VHD application
1.3) Name your VHD as you wish, select
Save location (VHD file name), select both
Use Vhdx (Hyper-V requires the file to be VHDX) and
Use Volume Shadow Copy, select which drives to include in your
VHD. Usually if you have done a default install and all your system files and folders are located on
C: you only need to select it
In addition to your Windows partition(s), remember to select the System Reserved partition (BIOS / MBR systems) or the Recovery Partition (UEFI / GPT systems), highlighted in below screenshots!
BIOS / MBR:
UEFI / GPT:
Click
Create to start creating the VHD to your selected location. Do not save VHD to any of the drives included in VHD being created!

Note
About the
Use Volume Shadow Copy selection:
Disk2VHD allows you to create a VHD of a system which will be currently used and online. Selecting
Use Volume Shadow Copy will cause Disk2VHD to create a
Shadow Copy of your system as it was at the very moment you clicked
Create. Creating the VHD might take quite a long time but as Disk2VHD reads the information it needs from the Shadow Copy, you can continue using your Windows as usual; any changes to the system like installed software or changes to desktop will not be included in VHD because they were done after the
Shadow Copy was created.
When you now click
Create, you will notice that Disk2VHD does not start to write the VHD before it has finished creating the Shadow Copy (snapshotting included drives):

1.4) This may take some time. Disk2VHD shows you an estimated time when it thinks the VHD will be ready, in my case this has usually been quite accurate. Creating the VHD now for this tutorial, the resulting just over 50 GB VHD took about 15 minutes to be created:
1.5) Click
Close when the VHD is ready
2.1) If not already done, enable, setup and run
Hyper-V as told in
Hyper-V tutorial, Part Two and create an external virtual switch as told in the same tutorial,
Part Three
2.2) Create a new virtual machine in Hyper-V selecting
Generation 1 (highlighted green in screenshot) in New Virtual Machine Wizard if your
Disk2VHD is from a
BIOS / MBR physical computer, and
Generation 2 (highlighted yellow) if it is from a
UEFI / GPT computer:
If you are not sure which partitioning system the PC you made VHD from is using, right click the
Start button on that computer and select
Disk Management, then right click
Disk 0 and select
Properties. Now select the
Volumes tab to see if your hard disk is
GPT partitioned (#1 in screenshot) or
MBR partitioned (#2):
2.3) In New Virtual Machine Wizard select
Use an existing virtual hard disk, browse to and select the VHD you created with
Disk2VHD, click
Open:
2.4) Click
Next:
2.5) Click
Finish:
2.6) If you made a Generation 1 virtual machine, you are ready to go. Jump to Part Four below. If your new virtual machine is Generation 2 with a UEFI / GPT VHD, continue from Part Three
Part Three
Prepare a GPT partitioned VHD
3.1) If you start the virtual machine now, you will see it can't boot:
Shut down the VM.
3.2) Open VM settings. Change boot order making it boot from DVD (#1), add a Windows ISO image as DVD (#2), click
OK to save settings:
You can use any Windows 10 version and edition ISO, it does not have to be for the version and edition installed on your new Disk2VHD virtual hard disk
3.3) Disable
Secure Boot:
3.4) Start VM, boot it from DVD (ISO). Press
SHIFT + 10 when you see
Windows Setup prompt to open
Command Prompt:
3.5) Enter command
diskpart to start Windows
Disk Partitioning Utility (#1 in screenshot below), enter command
list vol (#2) to get list of all partitions in your Disk2VHD virtual hard disk. You will see that Disk2VHD had deleted the
EFI partition (#3, by default 99 MB) making it RAW. Without it Windows on GPT partitioned disk cannot boot:
3.6) We need to format
EFI partition. As we can see with
list vol command (vol = volume), the EFI partition is
volume 3. Select it with command
sel vol 3 (#1 in next screenshot below), and format it with following command (#2):
Code:
format quick fs=fat32 label="System"
Enter the FORMAT command exactly as told! Be sure that you have selected the correct volume, the RAW one. No confirmation is asked, if you have selected wrong volume you might accidentally nuke Windows!
When done you can check again with
list vol (#3) to see that the EFI partition is now correctly formatted in
FAT32 file system (#4):
3.7) Enter command
exit to leave diskpart
3.8) One thing missing, we have to create
boot records. Before leaving diskpart I checked with
list vol command to see which letter my 40 GB Windows partition on this VHD has (in diskpart drive letters are not always obvious ones). In my case now the Windows partition has letter C:
I add boot records with command
bcdboot C:\Windows:
3.9) Open VM settings (File > Settings), change boot order to boot from
EFI file:
3.10) That's it. Close
Command Prompt, click
Close button in Windows Setup, click
Yes to restart.

Part Four
Run the new Windows vm
4.1) Select your virtual machine on Hyper-V Manager, click
Connect (#1) and wait until the vm windows has opened, then press
Start (#2) to boot the vm:
4.2) When your Windows 10 virtual machine has booted you will see your familiar lock screen and can sign in with any existing user profile:
4.3) When signed in you'll notice everything from your physical Windows 10 installation is there in your virtual machine, installed apps working:

That's it, now you can run your physical Windows 10 installation virtualized!
Kari