JosephM101/Force-Windows-11-Install

Avoid Windows 10/11 flavor issues with mount-windowsimage

dcasota opened this issue · 2 comments

Hi,
Good workaround project. Very helpful.
Successfully tested with 22533.1001.220107-2122.RS_PRERELEASE_CLIENTMULTI_A64FRE_EN-US.ISO. btw. mount-windowsimage is Windows flavor dependent and fails with "Windows cannot verify the digital signature for this file" when opening Windows 11 boot.wim with an older, non-compatible Windows 10 version. Try this:

$DismPath=<use default path or path to latest dism.exe>
# [...]
# Mount-WindowsImage -ImagePath $BootWIMFilePath -Index $BootWimImageIndex -Path $WIMScratchDir
$DismPath\dism.exe /mount-image /Imagefile:$BootWIMFilePath /Index:$BootWimImageIndex /Mountdir:$WIMScratchDir
# [...]
# Dismount-WindowsImage -Path $WIMScratchDir -Save
$DismPath\dism.exe /unmount-image /Mountdir:$WIMScratchDir /commit

Thanks for submitting this issue! I will modify the code and run some tests as soon as I have the time.

By the way, I really appreciate you giving me a bunch of info right off the bat. If you don't mind, I would like you to send me a screenshot of the error as well as the build information about the version of Windows 10 you tested this on. That way, I can try to replicate the issue and know what to look for.

Thank you for bringing this to my attention!

Time to move forward -> close ticket.

Here some thoughts though.

  • A try-catch for mount-windowsimage exceptions would be helpful. See line 720, screenshot.
  • In case of an exception, the user's system might need some attention.
    (get-command mount-windowsimage).module shows the module version. The issue occurs as example with dism v3.0. The component is updated with any major os update, sometimes with minor os updates, too.
  • Not using mount-windowsimage but dism.exe might be a bad workaround as pwsh is supported on many OS, but dism.exe not. On microsoft windows, the user could add the appropriate dism.exe path to the system variable PATH to avoid culprits with different Microsoft ADKs.