Book Image

Microsoft Hyper-V PowerShell Automation

By : Vinith Menon
Book Image

Microsoft Hyper-V PowerShell Automation

By: Vinith Menon

Overview of this book

Table of Contents (13 chapters)
Microsoft Hyper-V PowerShell Automation
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Virtual machine generation


With the introduction of the concept of virtual machine generation in Windows Server 2012 R2, the virtual machines have been classified broadly into two generations: generation 1 and generation 2. Generation 1 VMs can boot only from a disk attached to the IDE controller or network boot from a legacy network adapter. In addition, the boot configurations are taken care by BIOS. Generation 2 virtual machines are UEFI-based, which gives us features like secure boot; it allows us to boot the virtual machines from the SCSI disk and there is no requirement for an IDE controller-based boot method. Also, it allows network boot over the synthetic network adapter. Generation 2 virtual machines are UEFI based; this feature is supported only on windows 2012 or later versions and only on 64-bit operating systems. The boot time in generation 2 virtual machines is quicker than generation 1 virtual machines.

Creating either generation 1 or generation 2 virtual machines is very simple with PowerShell. You just need to specify an integer value for the generation parameter. The following examples show how you can go about doing this:

  • To create a generation 1 virtual machine, you can specify the generation type as 1, as shown in the following example:

    New-VM –Name "new 3" –MemoryStartupBytes 1GB –VHDPath d:\vhd\BaseImage.vhdx -Generation 1
    

    Note

    For these examples, you have the BaseImage.vhdx file placed at d:\vhd.

  • Similarly, to create a generation 2 virtual machine, you can specify the generation type as 2, as shown in the following example:

    New-VM –Name "new 3" –MemoryStartupBytes 1GB –VHDPath d:\vhd\BaseImage.vhdx -Generation 2