PowerTip: Create a New VHD with Windows PowerShell

PowerTip: Create a New VHD with Windows PowerShell

  • Comments 3
  • Likes

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

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Tried this under Server 2012 and it didn't work. What am I missing?

  • "New-VHD" command does not work under 'Server Core' edition. Is there some way so that the "New-VHD" command should work with 'Server Core' of Windows Serve 2012/R2.

  • Just used on 2012 r2 core - worked perfectly.