Building a Hyper-V Cluster – Creating Virtual Machines – Part 5/5

Creating and Managing VMs

In this video we will create highly available VMs.  First we create the virtual machines in the GUI then in PowerShell.

When creating a VM, ensure that you always check the box to store the virtual machine in a different location.  If you don’t do this, then the VM’s configuration file and VHD files will be put in the Hyper-V default location.  This is bad because it will be hard to tell what VHDs are associated configuration files.  If you check the store virtual machine in a different location check box all of the VM’s components will be stored in a single folder.  This will make your management life much easier!  Also, if the VM will be part of the cluster, be sure to create and manage the VM in failover cluster manager rather than Hyper-V manager.

Store the virtual machine in a different location

PowerShell PowerShell Code

#Create a new VM
New-VM -Name JasonVM -Path c:\ClusterStorage\CSV1

#Add the VM to the cluster so it becomes highly available
Add-ClusterVirtualMachineRole -VMName JasonVM

#Start the VM and live migrate it to another cluster node
Start-ClusterGroup -Name JasonVM
Move-ClusterVirtualMachineRole -Name JasonVM

#Create and remove VM Snapshot/Checkpoints
Checkpoint-VM -Name JasonVM
Get-VM -Name JasonVM| Get-VMSnapshot
Get-VM -Name JasonVM| Get-VMSnapshot| Remove-VMSnapshot

#Shut down the VM
Stop-VM -Name JasonVM

#List the Hyper-V and Failover Clustering commands
Get-Command -Module hyper-v, failoverclusters


MSDN: Virtual Machine Live Migration Overview
TechNet:Windows PowerShell: Create Hyper-V virtual machines

Check out the other post in this series!

4 thoughts on “Building a Hyper-V Cluster – Creating Virtual Machines – Part 5/5

  1. Pingback: Building a Hyper-V Cluster – Part 0/5 | Hyper-V Rockstar

  2. Gordon

    I thought I would let you know that unfortunately I can’t view any of the videos in your “Building a Hyper-V Cluster” series. I get different responses from IE, Edge, Chrome and Safari – “Error – Unsupported video type or invalid file path” (IE); “This type of video file isn’t supported” (Edge); The playback controls are not not available (greyed out) in Chrome and “Video format or MIME type is not supported” (Firefox).
    I have tried from Windows 7 & 10 as well as OSX – same deal.




Leave a Reply

Your email address will not be published. Required fields are marked *