PowerShell Tip: Create a New VHD with Windows PowerShell

In this PowerShell Tip I will explain you how to create a new virtual hard disk (VHD) in Hyper-V with PowerShell.

Use the New-VHD cmdlet:

To create for example a 60 GB dynamic disk VHDX file under C:\VHD\ called Mydrive.vhdx, execute the PowerShell line below:

NEW-VHD -Dynamic NEW-VHD -Dynamic "E:\Hyper-V\Virtual Hard Disks\MyDrive.vhdx" -SizeBytes 60GB -SizeBytes 60GB

To  create for example a 5 GB fixed disk VHDX file under C:\VHD\ called FixedDisk.vhdx, execute the PowerShell line below:

NEW-VHD -Fixed "E:\Hyper-V\Virtual Hard Disks\FixedDisk.vhdx" -SizeBytes 5GB

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s