PowerTip: Create a New VHD with Windows PowerShell

Summary: Use Windows PowerShell to create a new virtual hard disk to use with Hyper-V.

Hey, Scripting Guy! Question How can I create a new virtual hard disk in Hyper-V?

Hey, Scripting Guy! Answer Use the New-VHD cmdlet.

This will create a 60 GB dynamic disk VHDX file under C:\VHD\ called Mydrive.vhdx:

NEW-VHD -Dynamic C:\VHD\MyDrive.vhdx -SizeBytes 60GB

This will create a 5 GB fixed disk VHDX file under C:\VHD\ called FixedDisk.vhdx:

NEW-VHD -Fixed C:\VHD\FixedDisk.vhdx -SizeBytes 5GB