Using the Convert-WindowsImage.ps1 script to generate VHDs

The powershell script to convert Windows ISOs to VHDs works pretty well. However, its usage is pretty confusing and although it is documented on the page, it is buried half way through and I always struggle with it before I get it to work. So more than anything, this blog post is just there as a reminder to myself on how to do it correctly.

  1. run the script like the following “.      .\Convert-WindowsImage.ps1″ . This executes the powershell script and inserts a cmdlet with the exact same name “Convert-WindowsImage” into the powershell.
  2. You can now use the cmdlet to create a VHD like: PS D:\Software\win10vhd> Convert-WindowsImage -Edition “Enterprise” -SourcePath Windows_10_Enterprise_EN-US_x64.ISO  -VHDFormat VHDX -SizeBytes 100GB   -Verbose