Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Hyper-V PowerShell Automation

You're reading from   Microsoft Hyper-V PowerShell Automation Manage, automate, and streamline your Hyper-V environment effectively with advanced PowerShell cmdlets

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784391539
Length 124 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Vinith Menon Vinith Menon
Author Profile Icon Vinith Menon
Vinith Menon
Arrow right icon
View More author details
Toc

Table of Contents (8) Chapters Close

Preface 1. New PowerShell Cmdlets in Hyper-V on Windows Server 2012 R2 FREE CHAPTER 2. Managing Your Hyper-V Virtual Infrastructure 3. Managing Your Hyper-V Virtual Machines 4. Creating Reusable PowerShell Scripts Using Hyper-V PowerShell Module Cmdlets 5. The Next Step – Integration with SCVMM 6. Troubleshooting Hyper-V Environment Issues and Best Practices Using PowerShell Index

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:

  1. Open a PowerShell prompt in the Run as Administrator mode.
  2. 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.

  3. 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:

    Fundamental concepts of Hyper-V management with the Hyper-V management shell

    For example, in the following screenshot, the Remove-VMSwitch cmdlet itself says that it's used to delete a previously created virtual machine switch:

    Fundamental concepts of Hyper-V management with the Hyper-V management shell
  4. 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 the Update-Help cmdlet before executing the following cmdlet:
    Get-Help <Hyper-V cmdlet> -Full
    

    The following screenshot is an example of the Get-Help cmdlet:

    Fundamental concepts of Hyper-V management with the Hyper-V management shell
You have been reading a chapter from
Microsoft Hyper-V PowerShell Automation
Published in: Jan 2015
Publisher:
ISBN-13: 9781784391539
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image