Windows 10: Hyper-V - Create Custom Virtual Machine Gallery

Discus and support Hyper-V - Create Custom Virtual Machine Gallery in Windows 10 Tutorials to solve the problem; How to: Hyper-V - Create Custom Virtual Machine Gallery [img] Information Quick Create is a feature in Hyper-V allowing users to setup new virtual... Discussion in 'Windows 10 Tutorials' started by slicendice, Mar 10, 2018.

  1. Hyper-V - Create Custom Virtual Machine Gallery


    How to: Hyper-V - Create Custom Virtual Machine Gallery

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]
    Information Quick Create is a feature in Hyper-V allowing users to setup new virtual machines with a few mouse clicks. At the moment, Quick Create offers users a quick setup of Windows 10 Developer Environment, Windows 10 PRO edition with Visual Studio pre-installed:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]


    This at the moment "default" Quick Create option can change in the future as it allows Microsoft to offer any of their pre-set virtual machines to users.

    However, it's easy to change default Online Gallery as it is called to show your own preset virtual machines and quickly set them up from local or online repository:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]


    A repository or Online Gallery is where all pre-set virtual hard disks are located, to be used with Hyper-V Quick Create. When creating a personal VM Online Gallery, first thing to do is to decide if it will for just you personally, or if you want other users on your network or on Internet to access it.

    If you are just trying to make creating new Windows virtual machines faster and simpler for your own purposes, you can create repository on any hard disk, internal or external, on your PC, or in case you want all your computers to be able to access it, on a network share or local NAS.

    If you want your repository to be accessible over the Internet, you might be tempted to use Microsoft Azure or upload your virtual hard disk files to an FTP server, to a storage space on your own domain, and so on.

    This tutorial will show how to setup your own local Virtual Machine repository on local PC or network share. Just to give an example, I will also show how to use Microsoft Azure Blob Storage for an Online Gallery, accessible over the Internet and available to everyone knowing the link.

    Once again I ask you to trust me: tutorial might be quite long because I will try to make instructions clear enough for even virtualization and Hyper-V newbies to follow and it might look complicated, but this really is quite easy and relatively fast!



    Contents [/i] Click links to jump to any part
    [table][tr][td]Part One:[/td] [td]Copy or upload virtual hard disks to repository[/td] [/tr] [tr][td]Part Two:[/td] [td]Make Quick Create configuration files[/td] [/tr] [tr][td]Part Three:[/td] [td]Add virtual machines to Quick Create Online Gallery[/td] [/tr] [/table]




    Part One [/i] Copy or upload virtual hard disks to repository
    1.1) When you have selected the location of your repository, copy existing virtual hard disk files you want to be included in your Online Gallery to it. Alternatively, upload virtual hard disks to your online storage.

    For instance, if you have set up a VM in Hyper-V called W10PROv1709, and it's VHDX file is called W10PROv1709.vhdx, copy that single VHDX file from folder where it is located to your repository folder. Only the VHDX file is needed.

    Notice that Quick Create can only create Generation 2 virtual machines and virtual hard disks (UEFI / GPT). You can't use virtual hard disks from Generation 1 virtual machines.

    1.2) In case you want, you can just create a new Generation 2 VM, clean install Windows, shut down VM, copy the VHDX to repository and delete the new VM.

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]
    Tip A practical tip: When creating new VM just to get a VHDX to repository, shut down the VM when OOBE (Windows Welcome) starts showing the region and keyboard layout selection screen.

    This way, when you use the VHDX in Quick Create, new VM has Windows fully installed but it does not have any user accounts, allowing you to start from scratch.

    This, not creating a user account is especially important in case you allow other users to create virtual machines from your repository.
    1.3) If you want to, you can also create new virtual hard disks in Disk Management or using DISKPART. Notice that any virtual hard disk file to be used in Quick Create needs to be partitioned correctly (tutorial).

    My recommendation is to use Hyper-V instead of doing this manually; it makes everything automatically correct.




    Part Two [/i] Make Quick Create configuration files
    2.1) Each virtual hard disk in your Online Gallery needs a configuration file. These configuration files are in JSON file format, with extension .json.

    2.2) Below a sample Online Gallery configuration file:

    Code:
    Download the above sample JSON script: Sample.zip. Remember to unblock the ZIP archive first (tutorial). ZIP archive contains file Sample.json which can be opened and edited in Notepad or any other plain text / code editor.

    I recommend using Code Writer, available free on Store: Code Writer

    2.3) Open the extracted JSON file, edit it as you need to. In following steps short instructions for each block. First a screenshot to explain how different blocks affect what's seen in Quick Create interface:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]


    Numbers in screenshot refer to following steps below:
    1. Step 2.5, VM description and basic information
    2. Step 2.12, logo image
    3. Step 2.13, symbol image
    4. Step 2.14, thumbnail image
    5. Step 2.15, additional information
    2.4) A Hyper-V Online Gallery configuration file starts and ends with curly brackets (black highlight in below sample), followed by label "images" and a colon. Next an opening square bracket (blue highlight) and an opening curly bracket (red highlight), and their closing counterparts at the end of the script:

    Code:
    2.5) OK. First in script is basic information about your VM / VHDX file. Notice that everything within double quotes ("Everything here") can be whatever information / text you want to show in Quick Create. Be precise and informative. Do notice that every bracket, double quote and comma is important to keep syntax correct:

    Code:
    Line breaks (\n) must be added manually after each line of text, otherwise lines will be written in Quick Create without breaks following each other. Line break alone in double quotes ("\n") adds an empty line.

    In this sample I have added British English W10 PRO x64 build 17618 virtual hard disk to my VHD repository folder and am creating Quick Create entry for it.

    2.6) Enable (true) or disable (false) Secure Boot for this VM:

    Code:
    2.7) Minimum space requirement in bytes:
    Code:
    Leaving it to 0 will show no warning. To calculate how much storage space on your default Virtual Hard Disks drive will be required, simply double the maximum size of the dynamically expanding VHDX file and add a few GBs to assure functionality.

    An easy "rule of thumb": a VM needs double the size of its maximum VHD size. A VM with a 50 GB virtual hard disk needs 100 GB free storage space on host to function properly.

    For instance, if you have created a VM using the default 127 GB dynamically expanding VHDX, although its file size on host after clean installing Windows 10 to VM is only about 10 GB, it might and is allowed to grow to full 127 GB size when more software will be installed and files added. In addition, to run a VM requires an equivalent of its maximum file size (127 GB in this case) free storage space on same drive to expand when used.

    Changing the DiskSpace value for instance to 280,000,000,000 bytes would show this warning when user selects this VM in Quick Create:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]


    Notice that you must enter size in bytes without separators:
    Code:
    2.8) Next the most important part, the location of the VHDX file:

    Code:
    2.9) The location URI (Universal Resource Identifier), repository where VHDX is stored can be any of the following:

    - http://
    http://myfilestorage.mysite.com/W10PRx64.vhdx

    - https://
    https://myfilestorage.mysite.com/W10PRx64.vhdx

    - ftp://
    ftp://myfilestorage.myFTPServer.com/W10PRx64.vhdx

    - file://
    file://MyComputer/MyExternalHDD_Storage/VirtualHardDisks/W10PRx64.vhdx

    If your VHDX repository folder is called VHDX_Repo on local PC's drive F: and the VHDX file name is W10PRx64.vhdx, the URI would be as follows:

    file://F:/VHDX_Repo/W10PRx64.vhdx

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]
    Note Notice that if your URI is a network location like a share on another PC or NAS, you need to use IP plus port number. In most cases port 8080 works, if not consult your NAS manual.

    I have a WD MyCloud Mirror NAS using port 8080, my URI would be something like this:

    http://192.168.2.106:8080/Public/VHDX_Repo/W10PRx64.vhdx

    In case you have access to Azure Blob Storage, the URI would be as follows:

    https://STORAGE_ACCOUNT.blob.core.windows.net/RESOURCE_GROUP/FOLDER/FILENAME.vhdx
    2.10) An SHA256 hash for the VHDX file is required. You'll get it with an elevated PowerShell, with following command:

    Get-FileHash -Path "PATH\FILENAME" -Algorithm SHA256

    In screenshot I am getting SHA256 hash for a VHDX file W10 PRO IP x64 EN-GB (Skippy).vhdx in D:\Virtual Hard Disks folder:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]

    (Click to enlarge.)

    Double click hash value in PowerShell and press Enter to copy it to Clipboard, paste in your configuration file.

    2.11) File size is given in bytes, without separators. You'll find the exact size in bytes by right clicking the VHDX file and selecting Properties:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]


    The size of VHDX shown in above screenshot would be given as 19767754752. In case Properties shows different Size and Size on disk, use Size.

    2.12) Logo is a 130 * 30 pixel JPG image. Get SHA256 hash as told above in 2.10, and size as told in 2.11:
    Code:
    2.13) Symbol is a 35 * 35 pixel JPG image:
    Code:
    2.14) Thumbnail is a 800 * 450 pixel image:
    Code:
    2.15) Details shows additional information in Quick Create. For instance, I am too lazy to count the required minimum disk space as in step 2.7 above, using Details block instead:

    Code:
    Notice that in each block (steps 2.5 through this step), the closing bracket is always followed by a comma but in last block, like here in Details, the last block ends without comma.

    Let's see this again:

    Code:
    So, let's say I was not this lazy and had added the minimum space requirement in step 2.7. In that case I wouldn't need to add space requirement here in Details, in which case instead of two pieces of additional information I would only have one.

    In that case I would leave the comma away after closing bracket, the Details block being:

    Code:
    2.16) Save the JSON configuration file naming it as you wish, with extension .json. Notice that you need a JSON file separately for each VM you want to add to Quick Create.




    Part Three [/i] Copy or upload virtual hard disks to repository
    3.1) Open Registry Editor (WIN + R or Cortana, type regedit, hit Enter). Browse to following key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization

    3.2) Right click the right pane, select New > Multi-String Value:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]


    3.3) Rename the new Multi-String Value as GalleryLocations:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]


    3.4) Double click Multi-String Value GalleryLocations, add all your JSON files, one file in one line, click OK to save:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]


    That's it! You have now created your own Hyper-V Online Gallery and can create new virtual machines with pre-installed Windows with a single mouse click:

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]



    Kari


    Related Tutorials

    :)
     
    slicendice, Mar 10, 2018
    #1
  2. BulldogXX Win User
    BulldogXX, Mar 10, 2018
    #2
  3. Rex99ny Win User
    Where is the Hyper V Manager, How to I start it ?

    I am trying to setup an XP virtual Machine on Windows 10 Pro.

    I followed the steps in Neil Peterson article of 5/9/2016.

    System Requirements - done - ok

    Install Hyper-V - done - ok

    Create a Virtual Switch - skip

    Create a Virtual Machine

    Create a Virtual Machine with Hyper-V Manager

    These steps walk through how to manually create a virtual machine and deploy an operating system to this virtual machine.


    • In Hyper-V Manager, click Action > New >
      Virtual Machine
      to bring up the New

    Uhhhhhhhhh - this step obviously implies one knows

    1) Where the Hyper-V Manager is

    2) How to start the Hyper-V Manager

    Isn't that odd ?
     
    Rex99ny, Mar 10, 2018
    #3
  4. Hyper-V - Create Custom Virtual Machine Gallery

    So...instead of going to hack the registry, could this script be used instead?

    Code: [string[]]$gallerylocations = ( # Custom images "\\contoso\vmgallerysample\contoso.json", # Official Windows 10 developer images "https://go.microsoft.com/fwlink/?linkid=851584" ) $registrypath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization" Set-ItemProperty -Path $registrypath -Name GalleryLocations -Value $gallerylocations[/quote] Just a thought... *Smile
     
    slicendice, Mar 10, 2018
    #4
  5. Kari Win User
    Thanks!


    Yes.

    Or, a robust but not as elegant command / script:

    This would create value (/v switch) GalleryLocations as Multi-String Value (/t REG_MULTI_SZ) and add configuration files listed after /d switch, in this example all six configuration files shown in screenshots in tutorial. Separator between two configuration files is \0 (Windows default).

    If the GalleryLocations already exists with some configuration files, the switch /f at the end erases them overwriting with new values without prompting user. Without /f, user would be asked if overwrite or not.

    Hyper-V - Create Custom Virtual Machine Gallery [​IMG]
     
  6. I think we have a suitable coding project candidate here to make things even easier.

    Just click, drag and drop, type and commit project. Done! *Wink
     
    slicendice, Mar 10, 2018
    #6
  7. Jerry06 Win User
    Jerry06, Mar 11, 2018
    #7
  8. Kari Win User

    Hyper-V - Create Custom Virtual Machine Gallery

    Yes, that is a trial.
     
    Kari, Apr 4, 2018
    #8
Thema:

Hyper-V - Create Custom Virtual Machine Gallery

Loading...
  1. Hyper-V - Create Custom Virtual Machine Gallery - Similar Threads - Hyper Create Custom

  2. Issues with Hyper-V Virtual Machines

    in Windows 10 Network and Sharing
    Issues with Hyper-V Virtual Machines: Hi all, I'm running Ubuntu 19.04 in a Hyper-V Virtual Machine. It's configured to use Hyper-V's "Default Switch" network adapter, but for some reason, the VM doesn't seem to get internet access. My computer is connected to the Internet (both through Wi-Fi and Ethernet). I've...
  3. Hyper V- Virtual Machine Error

    in Windows 10 Updates and Activation
    Hyper V- Virtual Machine Error: While starting the Vistual Machine i am facing the below error shown in Event Viewer. Plz Help me out to resolve this problem. License Activation (slui.exe) failed with the following error code: hr=0x8007232B Command-line arguments:...
  4. Hyper V not connecting to virtual machine

    in Windows 10 BSOD Crashes and Debugging
    Hyper V not connecting to virtual machine: Suddenly, Hyper V would not connect to any Virtual Machine using the Virtual Machine Connection. I trying creating new VMs and nothing worked. I am using Windows 10 Education....
  5. Hyper-V - Optimizing Virtual Machines

    in Windows 10 Tutorials
    Hyper-V - Optimizing Virtual Machines: How to: Hyper-V - Optimizing Virtual Machines Running Windows on a virtual machine can naturally never be as fast as same version of Windows on same computer running on physical hardware. However, by tweaking virtual machine settings, you can greatly impact the speed and...
  6. Hyper-V Nested Virtualization: Run virtual machines on virtual machine

    in Windows 10 Tutorials
    Hyper-V Nested Virtualization: Run virtual machines on virtual machine: How to: Hyper-V Nested Virtualization: Run virtual machines on virtual machine [img] Information Nested Virtualization means that user can enable Hyper-V on existing virtual machines, and run virtual machines and Windows Sandbox on them. To make Nested Virtualization...
  7. Backing up Hyper-V Virtual Machines

    in Windows 10 Virtualization
    Backing up Hyper-V Virtual Machines: Hi, I was wondering if all I really need to do to backup activated virtual machines but not associated virtual hard drives is just to copy the virtual hard drive folder to another drive (or even one drive) . All I am really interested is in saving the machines which have...
  8. Virtual network is not created in Hyper-V

    in Windows 10 Virtualization
    Virtual network is not created in Hyper-V: Hi guys, I enabled Hyper-V feature in Windows 10 but unable to create a virtual switch. I tried to create private and internal types of virtual switch but every time the process stuck on "Applying changes". What could be the reason of that? Thank you. 61906
  9. Create Shortcut of Hyper-V Virtual Machine in Windows

    in Windows 10 Tutorials
    Create Shortcut of Hyper-V Virtual Machine in Windows: How to: Create Shortcut of Hyper-V Virtual Machine in Windows How to Create Shortcut of Hyper-V Virtual Machine in Windows 8 and 10 [img] Note There's nothing wrong in running the Hyper-V Manager and launch your virtual machines from there. However, creating a...
  10. Hyper-V Quick Create - Create or Copy a Virtual Machine

    in Windows 10 Tutorials
    Hyper-V Quick Create - Create or Copy a Virtual Machine: How to: Hyper-V Quick Create - Create or Copy a Virtual Machine [img] Information Windows 10 Insider Preview Build 15002 gave a facelift to Hyper-V as told earlier on Ten Forums. One of the new cool things is a new feature in Hyper-V Manager called Quick Create. With it...
Tags: