Fundamental concepts of Hyper-V management with the Hyper-V management shell
In this section, we will look at some of the fundamental concepts of Hyper-V management with the Hyper-V management shell. Once you get the Hyper-V role installed as per the steps illustrated in the previous section, a PowerShell module to manage your Hyper-V environment will also get installed. Now, perform the following steps:
- Open a PowerShell prompt in the Run as Administrator mode.
- PowerShell uses cmdlets that are built using a verb-noun naming system (for more details, refer to Learning Windows PowerShell Names at http://technet.microsoft.com/en-us/library/dd315315.aspx). Type the following command into the PowerShell prompt to get a list of all the cmdlets in the Hyper-V PowerShell module:
Get-Command -Module Hyper-V
Hyper-V in Windows Server 2012 R2 ships with about 178 cmdlets. These cmdlets allow a Hyper-V administrator to handle very simple, basic tasks to advanced ones such as setting up a Hyper-V replica for virtual machine disaster recovery.
- To get the count of all the available Hyper-V cmdlets, you can type the following command in PowerShell:
Get-Command -Module Hyper-V | Measure-Object
The Hyper-V PowerShell cmdlets follow a very simple approach and are very user friendly. The cmdlet name itself indirectly communicates with the Hyper-V administrator about its functionality. The following screenshot shows the output of the
Get
command:For example, in the following screenshot, the
Remove-VMSwitch
cmdlet itself says that it's used to delete a previously created virtual machine switch: - If the administrator is still not sure about the task that can be performed by the cmdlet, he or she can get help with detailed examples using the
Get-Help
cmdlet. To get help on the cmdlet type, type the cmdlet name in the prescribed format. To make sure that the latest version of help files are installed on the server, run theUpdate-Help
cmdlet before executing the following cmdlet:Get-Help <Hyper-V cmdlet> -Full
The following screenshot is an example of the
Get-Help
cmdlet: