Hi,
Here's a quick description of the method I used to install HyperV, Sandbox, and WSL2 in winpe11.
Of course, I use the initial Winpe11 that I built with my MicroWinpeBuilder script.
So, it will be difficult to create a script for traditional "builders" and projects like win10Xpe.
The method in a few lines:
- I have a VHD containing a Winpe from my script (ADK+additions) and an ISO from Windows 11.
- Added the context needed to install the FODs:useful context for OptionalFeatures.exe (useful for controls) ISO Components Hive
- additions in this hive Components that are from Winpe because the ADK brings some specificities.
- all files of .. \winsxs\manifests: a sorting would have to be done one day
- files in CatRoot
- modification of the SYSTEM hive
- SYSTEMSetupService Reporting APIBaselines
- Adding services and drivers (without .INF) not included in the FOD - lots of additions in ...\winsxs
- Added 4 FODs with DISM:
- Microsoft-Hyper-V-Hypervisor
- Containers-DisposableClientV
- Microsoft-Windows-Subsystem-Linux --> only for ADM account !!!
- VirtualMachinePlatform - Installing drivers for HyperV and VirtualNetwork with DISMAdding files that are not brought by DISM: the list is long and it is broken into several points of the script
This allows you to get an idea of the method. The script gives all the necessary details if needed.
Why not go further by proposing a script for a traditional "builder"?
Of course, it would be possible to identify all the differences (files, registers) to make a script.
But the usefulness of such a solution is far from proven.
This solution worked since winpe10-20H2. I had already shown HyperV in January 2021.
And no interest was shown.
This is proof that the need does not exist.
So I limit myself to what is called THE POC.
It has kept me busy this winter and it's already a lot. :smile:
Why a VHD?
- During the search:
The development of such a solution requires incessant mofications.
You have to explore various avenues, go back sometimes, add files, modify hives, etc.
I often compare with what I call the "FullFlat" reference.
I use Procmon traces a lot during startup. I often use WinDbg.
With a little practice, we understand that an ISO or a Boot.Wim is not the best media during this research.
But VHD lends itself well to this method which I summarize by "test-failure-comparison-modification".
- While using HyperV:
When everything works well, one could use an ISO file for HyperV because this technology uses little hives.
We find his old VMs if they were stored on an external media.
But it's quite annoying to have to rebuild the virtual network and the missing part of the context.
It is also true that VHD requires a backup of hives that is not "authorized" by MS.
- While using WSL2:
I have never used this feature. And I didn't do a test with winpe in an ISO file.
But I found that many parameters are stored in NTUSER. DAT.
The main EXT4 file. VHDX can be stored on external media.
That's why I use a VHD.
I drop here the script to add Hyperv Wsl Sandbox (sandbox is not finished) in Winpe11.
It is very messy because it is a work tool in perpetual evolution.
Note: it creates the VHD (MBR type) only once from the boot.wim file of my winpe.
Then "you" need to manually modify the variable in the script so as not to recreate it.
It's not a "builder", it's a work script, I repeat.
The script to make the base winpe
The lack of documentation of my scripts discourages potential testers.
But it is mainly the preparation and construction times that remain a brake and a repellent.
It takes several hours to:
- download and install ISO, ADK, "add-on" winpe,
- "unzip" the "install.wim" file with DISM,
- execute the various scripts,
- create the various vhd.
The choice to use the ADK and refuse the use of "non-MS" programs is a deliberate choice and one that I fully assume.
Computer viruses are numerous.
the script to add HyperV Wsl2 Sandbox
FR_W11_CreateWinpeFlatVhdHypervWslSandBox.7z
Yes, I know, very useless. But it's good for keeping my mind healthy.