Determine the Generation of a Hyper-V VM with PowerShell

Ever need to determine what generation all of the virtual machines are on your Hyper-V servers? This is simple using the Get-VM command that installs as part of the Hyper-V module for Windows PowerShell.

While the previous command will work on both clients and servers, the following command could also be used on a Windows server.

The generation of the VM is one of the properties from the results of Get-VM.

The previous example is a list of all the VM’s on my local Windows 10 system that has the Hyper-V role installed. This same command will work on Hyper-V servers and it can always be wrapped inside of Invoke-Command to have it run against numerous remote Hyper-V servers in parallel.

Thoughts, questions, comments? Please post them as a comment to this blog article.

µ

2 Comments

  1. vernanderson

    The primary difference between Gen1 and Gen2 is the difference between BIOS and UEFI boot
    If the OS supports UEFI boot make the VM Gen2
    Other differences are what you can do to the VM live vs having to shut it down to add things like CPU and RAM

    Reply
  2. Michael B.

    From within a VM, to detect whether it is Gen1 or Gen2, look at Win32-BIOS.Description. If it includes the string “UEFI”, then it is a Gen2 VM. If not, it is Gen1. (You can also look at Win32-BIOS.Manufacturer – Gen1 is “American Megatrends Inc.” whereas Gen2 is “Microsoft Corporation”.)

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: