How to create a virtual machine repository for Hyper-V Quick Create

Quick Create is a feature in Hyper-V that allows users to set up new virtual machines with just a few mouse clicks.

General information

Quick Create is a feature in Hyper-V that allows users to set up new virtual machines with just a few mouse clicks.Currently, Quick Create provides users with a quick way to set up a Windows 10 environment for developers (Windows 10 Developer Environment), and Windows 10 PRO version has Visual Studio pre-installed.

How to create a virtual machine repository for Hyper-V Quick Create Picture 1How to create a virtual machine repository for Hyper-V Quick Create Picture 1

This is at the present time, and the default Quick Create option may be changed in the future because it allows Microsoft to provide any virtual machine preinstalled to users.

However, it is not difficult to change the default Online Gallery.Online Gallery is used to display your own pre-installed virtual machines and quickly set them up from local or online archives.

How to create a virtual machine repository for Hyper-V Quick Create Picture 2How to create a virtual machine repository for Hyper-V Quick Create Picture 2

Online Gallery is also considered an online archive, which stores all preinstalled virtual hard disks, used with Hyper-V Quick Create.When creating a personal virtual machine Online Gallery, the first thing you need to do is decide whether it will be just for you, or you want to share it with other users in the system or even everyone. can access your Online Gallery.

If you just want to create new Windows virtual machines faster and simpler for your own purposes, you can create repositories on any hard disk, either locally or on your personal PC.In case you want all your computers to be able to access it, create it on a shared network or local NAS.

If you want your repository to be accessible over the Internet, you can use Microsoft Azure or upload virtual hard disk files to an FTP server, or to an archive with your own domain name .

This article will show you how to set up your own virtual machine repository on a local computer or to share on network systems.Only through a few examples, will you know how to use Microsoft Azure Blob Storage for an Online Gallery, accessible via the Internet and available to shared users.

Instructions can be quite long because it is relatively clear and detailed.New users of Hyper-V may find it complicated, but the process is actually quite easy and relatively fast!

How to create a virtual machine repository for Hyper-V Quick Create

  1. General information
  2. Copy or upload virtual hard disks to the archive
  3. Create Quick Create configuration files
  4. Copy or download a virtual hard disk into the archive

Copy or upload virtual hard disks to the archive

1.1) When you have selected your storage location, copy the existing virtual hard disk files that you want to include into the Online Gallery and also upload the virtual hard disks to your online repository.

For example, if you have set up a virtual machine in Hyper-V called W10PROv1709 , and it is a VHDX file in the W10PROv1709.vhdx format, copy that unique VHDX file, just need that VHDX file,

Note that Quick Create can only create second generation virtual machines and virtual hard disks (UEFI / GPT).You cannot use virtual hard disks from 1st generation virtual machines.

1.2) If desired, simply create a new 2nd generation virtual machine, install Windows, turn off the virtual machine, copy VHDX to the repository and then delete the new virtual machine.

Tips

In case if you create a new virtual machine just to get the VHDX file, turn off the virtual machine when OOBE (Windows Welcome) starts displaying the region selection screen and keyboard layout.This way, when you use VHDX in the Quick Create, the new virtual machine will have a full Windows installation but it does not have any user accounts, allowing you to start everything from scratch.Not creating user accounts is especially important in case you allow other users to create virtual machines from your repository.

1.3) If you want, you can also create new virtual hard disks in Disk Management or use DISKPART .Note that any virtual hard disk file used in Quick Create needs to be correctly split.Once created, you can deploy Windows using DISM.

Create Quick Create configuration files

2.1) Each virtual hard disk in your Online Gallery requires a configuration file.These configuration files have a JSON file format, with the extension .json.

2.2) Below are the sample Online Gallery configuration files:

 {"images": [{"name": "Windows 10 PRO EN-GB", "version": "Insider Preview 1803 Build 17618", "locale": "EN-GB", "publisher": " TenForums.com "," lastUpdated ":" 08-MAR-2018 "," description ": [" n "," Following software has been pre-installed: n "," - Office 2016 Pro Plusn "," - Visual Studio Enterprise 2017n " , "- Windows ADK for Windows 10n"], "config": {"secureBoot": true}, "requirements": {"diskSpace": 0}, "disk": {"uri": "file: // H : / VHD_Repo / W10PRO_EN -GB.vhdx "," hash ":" sha256: CD662725B917EAF17BCE0AE27D62A75D427DAF69DBAB610DE83D4E283EE535FD "," size ": 8862564352," archiveRelativePath ":" "}," logo ": {" uri ":" file: // E : / Users / Kari / OneDrive / Pictures / Hyper-V / TF_Logo.jpg "," hash ":" sha256: 567577C39FFD817A30752FC50004137F85EEB84DD8988C3F6F4EEFC2DDA0BD57 "," size ": 8325," archiveRelativePath ":" "}," symbol ": {" uri ":" file: // E: /Users/Kari/OneDrive/Pictures/Hyper-V/W10_35.jpg "," hash ":" sha256: B64B86CB68A35BBFC642D0725D5C570041DFEF66986C4A77EABFDDCB6D33467D "," size ": 1913," archiveRelativePath " : ""}, "thumbnail": {"uri": "file: // E: / Users / Kari / OneDrive / Pictures / Hyper-V / W10G -TF.jpg ", "hash": "sha256: 3630837726027EB4E5DCD5259577886ECB7F1EF61332086656D64FF6AAFD4268" , "size": 39466, "archiveRelativePath": ""}, "details": [{"name": "Space required", "value": "256 GB"}, {"name": "Additional info", "value": "Boots to OOBE (no users)"}]}]} 

You can Download or copy the sample JSON script above: Sample.zip.Remember to unlock the ZIP file first, then extract it.This ZIP file contains the Sample.json file that can be opened and edited in Notepad or any other text / code editor.

2.3) Open the JSON file after extracting, edit if necessary.In the following steps, there will be short instructions for each block.The first is a screenshot to explain how different blocks of code affect what is seen in the Quick Create interface:

The numbers in the screenshot refer to the following steps:

How to create a virtual machine repository for Hyper-V Quick Create Picture 3How to create a virtual machine repository for Hyper-V Quick Create Picture 3

  1. Step 2.5, description of VM and basic information
  2. Step 2.12, logo image
  3. Step 2.13, icon image
  4. Step 2.14, thumbnail
  5. Step 2.15, additional information

2.4) Hyper-V Online Gallery configuration file starts and ends with curly braces (highlighted in black in the form below), followed by the " images " and colons.Next an open square brackets and an open curly brace.

 { "images": [ { The rest of the script will appear here } ] } 

2.5) The first data in the script is the basic information about your VHDX virtual machine file.Note that everything must be enclosed in quotation marks ("Everything here") can be any information or text you want to display in Quick Create.Try to enter correctly.Note that all brackets, quotes and commas are very important in keeping the syntax correct.

 "name": "Windows 10 PRO EN-GB", "version": "Insider Preview 1803 Build 17618", "locale": "EN-GB", "publisher": " TenForums.com ", "lastUpdated": " 08-MAR-2018 "," description ": [" n "," Following software has been pre-installed: n "," - Office 2016 Pro Plusn "," - Visual Studio Enterprise 2017n "," - Windows ADK for Windows 10n "], 

The line break (n) must be typed after each line of text, otherwise the lines in Quick Create will not be interrupted.Line breaks in quotation marks ("n") will add a blank line.

In the above example, the virtual British English W10 PRO x64 build 17618 hard disk has been added to the VHD storage folder and created the Quick Create item created for it.

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

 "config": { 
"secureBoot": true
},

2.7) Minimum space requirement in bytes:

 "requirements": { 
"diskSpace": 0
},

If left at 0, no warning will be displayed.To calculate how much storage space on your default virtual hard drive will be required, simply double the maximum size of the extended VHDX file and add a few GB to be sure.

There is a simple rule like this: A virtual machine will need twice the maximum size of its VHD.Virtual machines with 50 GB virtual hard drives need about 100 GB of free storage on the server to work properly.

For example, if you created a virtual machine using the default 127 GB VHDX file extension.although its file size on the server after installing Windows 10 on a virtual machine is only about 10 GB, but it can and is allowed to expand up to 127 GB in size when the software is installed and the files Information added to virtual machine.In addition, to run a virtual machine requires free storage equivalent to the maximum file size (127 GB in this case) on the same drive to be extended when used.

If you change the DiskSpace value to 280 billion bytes, this warning will show when the user selects this virtual machine in Quick Create:

How to create a virtual machine repository for Hyper-V Quick Create Picture 4How to create a virtual machine repository for Hyper-V Quick Create Picture 4

Note that you must enter the size in bytes without the separator:

 "requirements": { 
"diskSpace": 2.8 billion
},

2.8) Next is the most important part, setting the location of the VHDX file:

 "disk": {"uri": "file: // H: / VHD_Repo / W10PRO_EN -GB.vhdx ", "hash": "sha256: CD662725B917EAF17BCE0AE27D62A75D427DAF69DBAB610DE83D4E283EE535FD", "size": 8862564352, "archiveRelativePath": ""}, 

2.9) URI (Common Resource Identifier), the repository where the hosted VHD can be located in any of the following locations:

- 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 storage directory is called VHDX_Repo on the local computer drive F: and the VHDX file name is W10PRx64.vhdx , the URI will be as follows:

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

Attention

Note that if your URI is a network location like a PC or NAS share, you need to use IP plus the port number.In most cases, port 8080 will work, otherwise refer to your NAS manual.

For example, if I have a WD My Cloud Mirror NAS using port 8080, my URI will look like this:

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

In case you have access to Azure Blob Storage, the URI will look like this:

 https://STORAGE_ACCOUNT.blob.core.windows.net/RESOURCE_GROUP/FOLDER/FILENAME.vhdx 

2.10) A SHA256 hash function is required for VHDX file. To get the hash function, use the following command in PowerShell "

 Get-FileHash -Path "PATHFILENAME" -Algorithm SHA256 

In the screenshot is the SHA256 hash function for a VHDX W10 PRO IP x64 EN-GB (Skippy) .vhdx file in the folder D: Virtual Hard Disks.

How to create a virtual machine repository for Hyper-V Quick Create Picture 5How to create a virtual machine repository for Hyper-V Quick Create Picture 5

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

2.11) File size is calculated in bytes, with no separator. You will find the exact size of the file by right-clicking on the VHDX file and selecting Properties :

How to create a virtual machine repository for Hyper-V Quick Create Picture 6How to create a virtual machine repository for Hyper-V Quick Create Picture 6

The size of VHDX shown in the screenshot above is 19767754752. In case the two values Size and Size on disk do not match, or only interested in the Size value .

2.12) Logo is a JPG image with dimensions of 130 * 30 pixels.Get the SHA256 hash value as mentioned above in step 2.10 and size as mentioned in step 2.11:

 "logo": {"uri": "file: // E: / Users / Kari / OneDrive / Pictures / Hyper-V / TF_Logo.jpg ", "hash": "sha256: 567577C39FFD817A30752FC50004137F85EEB84DD8988C3F6F4EEFC2DDA0BD57", "size": 8325, "archiveRelativePath": ""}, 

2.13) Icon is a JPG image of 35 * 35 pixels in size:

 "symbol": { 
"uri": "file: // E: /Users/Kari/OneDrive/Pictures/Hyper-V/W10_35.jpg",
"hash": "sha256: B64B86CB68A35BBFC642D0725D5C570041DFEF66986C4A77EABFDDCB6D33467D",
"size": 1913,
"archiveRelativePath": ""
},

2.14) Thumbnails are images 800 * 450 pixels:

 "thumbnail": {"uri": "file: // E: / Users / Kari / OneDrive / Pictures / Hyper-V / W10G -TF.jpg ", "hash": "sha256: 3630837726027EB4E5DCD5259577886ECB7F1EF61332086656D64FF6AAFD4268", "size": 39466, "archiveRelativePath": ""}, 

2.15) Details section displays additional information in Quick Create. For example, you don't want to count the minimum disk space needed as in step 2.7 above, or use Details.

 "details": [ 
{
"name": "Space required",
"value": "256 GB"
},
{
"name": "Additional info",
"value": "Boots to OOBE (no users)"
}
]

Note that in each block (from step 2.5 to this step), curly braces are always followed by commas, but in the last block, as here is Details , there will be no commas followed}.

Specifically:

 "details": [{"name": "Space required", "value": "256 GB" }, < This is a comma followed by curly braces} {"name": "Additional info", "value": "Boots to OOBE (no users)" } < In curly braces in the last block, there are no commas after that ] 

2.16) Save the JSON configuration file as you want, with the extension.json .Note that you need a separate JSON file for each virtual machine you want to add to Quick Create.

Copy or download a virtual hard disk into the archive

3.1) Open Registry Editor (WIN + R or, type regedit in Cortana, press Enter).Browse to the following key:

 HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionVirtualization 

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

How to create a virtual machine repository for Hyper-V Quick Create Picture 7How to create a virtual machine repository for Hyper-V Quick Create Picture 7

3.3) Rename Multi-String Value to GalleryLocations :

How to create a virtual machine repository for Hyper-V Quick Create Picture 8How to create a virtual machine repository for Hyper-V Quick Create Picture 8

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

How to create a virtual machine repository for Hyper-V Quick Create Picture 9How to create a virtual machine repository for Hyper-V Quick Create Picture 9

Now you have created your own Hyper-V Online Gallery and can create new virtual machines with Windows pre-installed with just one click:

How to create a virtual machine repository for Hyper-V Quick Create Picture 10How to create a virtual machine repository for Hyper-V Quick Create Picture 10

Good luck!

See more:

  1. How to change the default directory for hosting Hyper-V virtual machines in Windows 10
  2. How to create and use Hyper-V checkpoints in Windows 10
  3. How to import Hyper-V virtual machines in Windows 10
  4. How to export Hyper-V virtual machines in Windows 10
4.1 ★ | 38 Vote