Building a virtual machine gallery in Windows 10

One of the ways that the Windows 10 implementation of Hyper-V differs from what exists in Windows Server is that Windows 10 offers a quick create option for virtual machines. Rather than working through the New Virtual Machine Wizard, you can instead right-click on the host name within the Hyper-V Manager, and choose the Quick Create option from the shortcut menu.

When you select the Quick Create option, the Hyper-V Manager opens a screen like the one that is shown in the screenshot below. As you can see, Hyper-V gives you the option of setting up a Windows 10 Dev environment, Ubuntu, or the MSIX Packaging Tool Environment. As convenient as this may be, you are not limited to solely using the options that are presented on the screen. You can augment the list of choices to meet your own needs.
virtual machine gallery

Two main steps

There are two main steps in adding an item to the virtual machine gallery. One step is to provide installation media. The installation media can be an ISO file, or a Generation 2 VM (a sysprepped Windows image within a 200GB or larger VHDX file).

The other step is to create a JSON file that corresponds to the installation media that you are using. This is by far the more difficult of the two steps, so that’s what I am going to focus this article on.

The first thing that you will need to do is to create a registry key. Remember, editing the registry can be dangerous, so it’s always a good idea to create a backup before you begin. With that said, open the Registry Editor and create a multi-string value registry key named GalleryLocations at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization

Next, you will need to pick a folder that can act as a repository for your JSON file. For the purposes of this folder, I am going to use a folder named C:\Users\Brien\Gallery. Whatever path you choose, create the folder, and then add the folder’s path and a file name (I will use GalleryHyperV.JSON) to the registry key. You can see an example of this in the screenshot below.

virtual machine gallery
The next thing that you will need to do is to download a JSON file that you can populate with the necessary information. You can download the file by clicking here. As you look at the screenshot below, you can see that the previously existing virtual machine gallery items are already listed within the JSON file. This makes it significantly easier to populate the file.

virtual machine gallery
As you examine the JSON file, you will notice that each individual image is enclosed in braces {} and the images are separated from one another with a comma. I recommend copying the entries corresponding to the first image, and then pasting it at the end of the file (just after the comma, but before the last bracket and brace).

Is Hyper-V recognizing your modifications?

Once you have done this, it’s a good idea to make sure that Hyper-V is correctly recognizing your modifications. In my case, I copied the Windows 10 Dev Environment Image. In my copy, I changed the name to Windows 10 Custom Environment, and then saved the file. Upon opening Hyper-V Manager and attempting a quick create, I found that my Windows 10 Custom Environment image was listed, as shown below.

As you examine the JSON file, you will no doubt discover that it includes a lot of information. Although not all of the fields are required, I strongly recommend populating each and every field. Doing so will help you to avoid problems, and will also allow Hyper-V Manager to display more comprehensive information about your operating system.

There are a few things that you are going to need to pay attention to as you edit the JSON file. First, the location of the installation media (which is listed as Disk), the logo, the symbol (which is essentially just a larger logo), and the thumbnail are all referenced by URI, as shown in the next screenshot. Therefore, you should plan on using a Web server (either in house or in the cloud) to host these files. There is an option to use a local installation source, but personally I find using a Web server to be easier.

The installation media and the graphics that are displayed within Hyper-V manager must be accessible from a URI.

You will also notice that the JSON provides a SHA256 hash for each of the items that is to be downloaded. Windows uses this hash as a way of verifying the authenticity of the files that it is downloading. If you plan to reuse the files listed in the previous screen capture, then you can also use the existing file hashes. If you are going to use your own files however, then you will need to generate a custom file hash. The easiest way to do this is to use PowerShell. Suppose for example, that I needed to create a file hash for an ISO file named MyOS.ISO. I could get the hash by using this command:

Get-FileHash MyOS.ISO -Algorithm SHA256

If you look at the screenshot below, you can see that I have generated a file hash for a Windows Server 2016 ISO file.

Setting up a virtual machine gallery: Some last tips

For the most part, setting up a virtual machine gallery option is a relatively straightforward process. The only other bit of advice that I would give you is to be sure to match the formatting of existing entries within the JSON file. This is especially true for the Last Updated date, and the Locale. Hyper-V expects the information in those fields to adhere to a specific format.

Featured image: Pixabay

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top