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.
#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