Tag Archives: Cluster

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

Resources

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

Check out the other post in this series!

Building a Hyper-V Cluster – Part 0/5

In this Quick Start Series we will show you how quickly and easily you can set up your own Hyper-V Cluster using server 2012R2 and iSCSI target server for shared storage.  In each video we show you how to configure the server using the GUI and then we show how to do the same configuration steps in PowerShell.
To reproduce the environment in this video series you need:
  • 2 physical computers for Hyper-V hosts
  • 1 VM/Physical server for iSCSI target software
  • Install any Windows Server 2012R2 SKU Core/Full
  • Network connectivity with at least 1 NIC between all the systems