Skip to content

Instantly share code, notes, and snippets.

@PatrickLang
Last active April 18, 2024 19:52
Show Gist options
  • Save PatrickLang/cd89cc0d56510d54da409ed0be554dc1 to your computer and use it in GitHub Desktop.
Save PatrickLang/cd89cc0d56510d54da409ed0be554dc1 to your computer and use it in GitHub Desktop.
Building an up to date Windows 10 VHDX

Get Convert-WindowsImage.ps1

Download it at https://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f

Get the base Windows 10 image

Use the Windows Media Creation Tool to download an ISO. Only X64 is needed.

Get the latest cumulative update

Check Windows 10 Update History for the latest KB number. Then search the update catalog - example: http://www.catalog.update.microsoft.com/Search.aspx?q=3194798

Find the download link, and download the MSU. Example for KB3194798:

Start-BitsTransfer http://download.windowsupdate.com/c/msdownload/update/software/secu/2016/10/windows10.0-kb3194798-x64_8bc6befc7b3c51f94ae70b8d1d9a249bb4b5e108.msu

Build It

. .\Convert-WindowsImage.ps1
Convert-WindowsImage -SourcePath .\Win10.ISO -Edition Enterprise -VHDPath 14393_kb3194798_base.vhdx
-SizeBytes 40Gb -VHDFormat VHDX -VHDType Dynamic -Feature Microsoft-Hyper-V-All, Containers -VHDPartitionStyle GPT -Package .\windows10.0-kb3194798-x64_8bc6befc7b3c51f94ae70b8d1d9a249bb4b5e108.msu

Example output:

Windows(R) Image to Virtual Hard Disk Converter for Windows(R) 10
Copyright (C) Microsoft Corporation.  All rights reserved.
Version 10.0.9000.0.amd64fre.fbl_core1_hyp_dev(mikekol).141224-3000 Beta

INFO   : Opening ISO 14393.0.160715-1616.RS1_RELEASE_CLIENTENTERPRISE_VOL_X64FRE_EN-US.ISO...
INFO   : Looking for E:\sources\install.wim...

INFO   : Image 1 selected (Enterprise)...
INFO   : Creating sparse disk...
INFO   : Attaching VHDX...
INFO   : Disk initialized with GPT...
INFO   : Disk partitioned
INFO   : System Partition created
INFO   : Boot Partition created
INFO   : System Volume formatted (with DiskPart)...
INFO   : Boot Volume formatted (with Format-Volume)...
INFO   : Access path (G:\) has been assigned to the System Volume...
INFO   : Access path (H:\) has been assigned to the Boot Volume...
INFO   : Applying image to VHDX. This could take a while...
INFO   : Signing disk...
INFO   : Image applied. Making image bootable...
INFO   : Drive is bootable. Cleaning up...
INFO   : Installing Windows Feature(s) Microsoft-Hyper-V-All Containers to the Image
INFO   : From E:\sources\sxs
INFO   : Adding Windows Packages to the Image
INFO   : Package path: .\windows10.0-kb3194798-x64_8bc6befc7b3c51f94ae70b8d1d9a249bb4b5e108.msu
INFO   : Closing VHDX...

INFO   : Closing Windows image...
INFO   : Closing ISO...
INFO   : Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment