riklus / win10install-onusb

This batch script allows you to install Windows 10 on an external usb drive.
MIT License
5 stars 1 forks source link

Install script for a .esd file. #1

Closed CortexReaver closed 2 years ago

CortexReaver commented 2 years ago

What should I fix in the bat file to make installation possible with a compressed esd file? Do I need to use "/export-image" command and convert it to wim first?

CortexReaver commented 2 years ago

Correct me if I wrong (I've copied just installation section):

::
:: Installation Section
::

echo [i] Converting an Copying Recovery Image...
md R:\RecoveryImage
cd X:\Windows\System32
dism /export-image /SourceImageFile:G:\sources\install.esd /SourceIndex:1 /DestinationImageFile:R:\RecoveryImage\install.wim /Compress:recovery

echo [i] Deploying Windows Image...
dism /Apply-Image /ImageFile:R:\RecoveryImage\install.wim /Index:1 /ApplyDir:W:\

echo [i] Copying Recovery Tools...
md T:\Recovery\WindowsRE
copy W:\Windows\System32\Recovery\winre.wim T:\Recovery\WindowsRE\winre.wim

echo [i] Writing Boot Configuration Data...
bcdboot W:\Windows /s S: /f UEFI

echo [i] Setting up Recovery Environment...
W:\Windows\System32\reagentc /setosimage /path R:\RecoverImage /target W:\Windows /index 1
W:\Windows\System32\reagentc /setreimage /path T:\Recovery\WindowsRE /target W:\Windows

echo Installation done.

"G" is a usb drive letter with Windows 10 installation files.

riklus commented 2 years ago

When you run dism to export the image to R:\RecoveryImage\, you specify the parameter /Compress:recovery, which requires a destination image file that ends with .esd.

You can read about it in the DISM Image Management Command-Line Options.

So I suggest you to use this:

echo [i] Exporting Recovery Image...
md R:\RecoveryImage
cd X:\Windows\System32
dism /export-image /SourceImageFile:G:\sources\install.esd /SourceIndex:1 /DestinationImageFile:R:\RecoveryImage\install.esd /Compress:recovery

And of course, you also have to update the Deploy subsection to use the install.esd file:

echo [i] Deploying Windows Image...
dism /Apply-Image /ImageFile:R:\RecoveryImage\install.esd /Index:1 /ApplyDir:W:\

I cannot test this right now though. Give it a try.

CortexReaver commented 2 years ago

Windows have been installed successfully, and it's working fine. Although I am not sure about recovery tools, because it gave me error messages about some "agent" at the end. May be it was just my copy of Windows, idk.

riklus commented 2 years ago

I will close this issue then. If the recovery tools do not work feel free to open another issue.