Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Windows Server

Disk2vhd: turn a Windows PC into a Hyper-V virtual machine

Turn a physical Windows machine into a VM with Disk2vhd: prepare it, capture a VHDX, choose Hyper-V generation 1 or 2, fix the first boot, mind the license.

CloudSat teamNovember 18, 20266 min read
Abstract illustration of a desktop tower dissolving into a stream of small cubes that reassemble as a translucent box inside a larger glowing frame.
On this pageIs P2V the right move?

Physical-to-virtual conversion (P2V) turns a running computer into a virtual disk that a hypervisor can boot. The usual reasons are practical: the hardware is dying but one old application on it cannot be reinstalled, you want a copy to test changes on, or you want a complete image before retiring a machine. Disk2vhd, a free Sysinternals tool by Mark Russinovich, does the capture from inside the running Windows system. This guide covers preparing the source, capturing it, booting it in Hyper-V, and the licensing question that comes with it.

Is P2V the right move?

P2V copies everything, including years of drivers, utilities and leftovers. When the application can be reinstalled and its data exported, a fresh system is cleaner. P2V earns its place when:

  • the installer, license file or know-how for an application is lost;
  • a configured machine must keep working exactly as it is while you plan a proper migration;
  • you need a full image as a safety net before wiping hardware.

It does not help with software tied to physical hardware, such as USB license dongles or licenses bound to a motherboard ID.

Settle the license first

Windows on a store-bought PC usually carries an OEM license, which belongs to that hardware. Microsoft's own Disk2vhd page states that OEM copies of the Windows versions it lists may not be transferred to a virtual hard drive, and OEM licenses in general stay with the device they came with. Plan on licensing the VM separately with a retail or volume license, or through the virtualization rights of a Windows Server license on the host. After the move, Windows sees new hardware and may ask to be activated again. Check application licenses as well; some are bound to hardware identifiers.

Prepare the source machine

  1. Check the firmware mode. In PowerShell, $env:firmware_type prints UEFI or Legacy. It decides the VM generation later.
  2. Turn off BitLocker. Disk2vhd cannot capture encrypted volumes. Run manage-bde -off C: and wait until manage-bde -status reports the volume fully decrypted.
  3. Check the disk with chkdsk C: /scan, and fix errors before you copy them.
  4. Write down the network settings, especially static IP addresses, and collect license keys for the applications on board.
  5. Prepare a target on a different disk or a network share. Disk2vhd can write to the volume it is converting, but it is faster and safer to write elsewhere. The image needs roughly the used space of the volumes you capture, not the full disk size.

Capture with Disk2vhd

Download it from https://download.sysinternals.com/files/Disk2vhd.zip (version 2.02 is current) and run it as administrator. In the window:

  • tick Use Vhdx for the modern format, which Hyper-V generation 2 requires;
  • keep Use Volume Shadow Copy ticked, so the capture is a consistent point-in-time snapshot while Windows keeps running;
  • select the Windows volume and the boot partition: the EFI System Partition on UEFI machines, or System Reserved on older BIOS installs. Without it the copy will not boot. The recovery partition is optional.

Disk2vhd creates one virtual disk per physical disk, keeps the partition layout and copies only the selected volumes. Close databases and heavy applications first, or accept that programs without a shadow copy writer are captured as if the power had been cut at that moment. A command-line form exists for scripted captures, with drive letters or * for every volume:

disk2vhd * E:\p2v\pc01.vhd

One rule from the documentation matters: do not attach the new disk on the machine you captured if you plan to boot from it. Windows would give it a new disk signature to avoid a collision, and the copy would no longer find its boot disk.

Create the virtual machine in Hyper-V

Copy the file to the Hyper-V host and match the generation to the source:

Source firmware VM generation Disk format
UEFI with a GPT disk Generation 2 VHDX only
Legacy BIOS with an MBR disk Generation 1 VHD or VHDX
New-VM -Name PC01 -Generation 2 -MemoryStartupBytes 4GB -VHDPath D:\VMs\pc01.vhdx -SwitchName "Default Switch"
Set-VMProcessor -VMName PC01 -Count 2
Set-VMKeyProtector -VMName PC01 -NewLocalKeyProtector     # needed before a virtual TPM
Enable-VMTPM -VMName PC01                                  # Windows 11 guests require TPM 2.0
Start-VM -Name PC01
vmconnect localhost PC01

Default Switch exists on Windows 10 and 11 hosts; on Windows Server, create an external virtual switch first. For a BIOS-era source, use -Generation 1, and Hyper-V attaches the disk to the IDE controller that generation boots from.

The first boot

On first start, Windows detects the virtual hardware and installs drivers. Current versions of Windows and Windows Server include the Hyper-V integration components, so the mouse, network and storage work after a restart or two. Then tidy up:

  • Uninstall hardware utilities that no longer apply: RGB and fan tools, vendor update agents, OEM support apps.
  • Configure the new virtual network adapter. A static address may still be bound to the old, now hidden adapter, and Windows warns about a duplicate if you reuse it.
  • Check activation under Settings, System, Activation.
  • Reclaim space later: shut down the VM, mount the disk read-only with Mount-VHD -Path D:\VMs\pc01.vhdx -ReadOnly, run Optimize-VHD -Path D:\VMs\pc01.vhdx -Mode Full, then Dismount-VHD it.

If the VM does not boot, the usual causes are a missing boot partition in the capture, the wrong generation, or BitLocker still active. An INACCESSIBLE_BOOT_DEVICE stop means Windows lacks a driver for the virtual storage controller; BIOS storage modes and Windows explains why that happens.

Other hypervisors and the cloud

Proxmox VE and other KVM platforms prefer qcow2 or raw disks, and qemu-img converts VHDX into either; types of virtual machines shows the commands. Windows guests on KVM also need the VirtIO drivers: attach the disk as SATA for the first boot, install the drivers, then switch the controller to VirtIO.

If the goal is to get the old machine out of the office entirely, a CloudSat Windows VPS with nested virtualization, available on plans with 8 GB or more for 11% extra, can run Hyper-V and host the captured VM. When the installer still exists, a fresh install of the application on a new server remains the cleaner end state.

FAQ

Can Disk2vhd capture a Linux machine?

No. It is a Windows tool built on the Volume Shadow Copy service. For Linux, image the disk with dd or Clonezilla, or rebuild on the new platform and copy the data.

Do I have to shut the source machine down?

No, that is the point of the shadow copy. Applications with their own shadow copy writer, such as SQL Server, are captured consistently. Others are captured mid-flight, so stop them first if their data matters.

Can I keep using the physical machine afterward?

Technically yes, but two identical Windows installations on one network clash: same computer name, same security identifiers in a domain, and possibly the same license. Rename or disconnect one of them, and if the machine is domain-joined, keep only one copy on the network.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.