ESD <> WIM Conversion batch

Discussion in 'Scripting' started by liliactr, Apr 16, 2014.

  1. liliactr

    liliactr MDL Member

    Sep 3, 2009
    202
    83
    10
    #1 liliactr, Apr 16, 2014
    Last edited by a moderator: Apr 20, 2017
    I need a batch file that will convert install.esd to install.wim or vice versa.

    Forexample install.esd has 4 indexes, batch will convert it to editable install.wim with 4 indexes or vice versa. It is very problematic to apply an esd to a folder and export to a wim file again (most difficult part is delete that folder again). murphy78 has a great batch smiler to it but it needs to be edited for my aim. It creates a vhd drive, applies to it, creates wim from it and deletes vhd drive.

    here is his batch if he gives permissions.

    Code:
    @echo off
    title ESD DECRYPTION
    color 1f
    %windir%\system32\reg.exe query "HKU\S-1-5-19" >nul 2>&1 || (
    echo      -------
    echo  *** WARNING ***
    echo      -------
    echo.
    echo.
    echo ADMINISTRATOR PRIVILEGES NOT DETECTED
    echo ____________________________________________________________________________
    echo.
    echo This script require administrator privileges.
    echo.
    echo To do so, 'Open Command Prompt as administrator' in the current directory.
    echo.
    echo or right click on Command Prompt and select 'Run as administrator'
    echo then change location to the script directory.
    echo.
    echo Press any key to exit...
    pause >nul
    goto :eof
    )
    cd /d "%~dp0"
    if exist %CD%\dism\dism.exe set Path=%CD%\dism;%Path%
    SET ENCRYPTEDESD=
    SET ERRORTEMP=
    SET DECRYPTED=0
    SET WINDOWSNAME=
    SET VDISK="%CD%\vdisk.vhd"
    
    SET ENCRYPTEDESD=%~1
    dism /get-wiminfo /wimfile:"%ENCRYPTEDESD%" >nul 2>&1 || (
    echo.
    echo Incorrect Usage or filename.
    echo.
    echo Usage: decrypt filename.esd
    echo.
    echo Press any key to exit.
    pause >nul
    goto :eof
    )
    
    for /f "tokens=1* delims=: " %%i in ('dism /english /get-wiminfo /wimfile:%1 /index:4 ^| find /i "Name"') do set WINDOWSNAME="%%j"
    IF %ERRORLEVEL% NEQ 0 (
    ECHO There is a problem reading the index name.
    echo.
    echo Press any key to exit.
    pause >nul
    goto :eof
    )
    
    for /f "tokens=2 delims=: " %%i in ('dism /english /get-wiminfo /wimfile:%1 /index:4 ^| find /i "Architecture"') do set arch=%%i
    IF %ERRORLEVEL% NEQ 0 (
    ECHO There is a problem reading the index architecture.
    echo.
    echo Press any key to exit.
    pause >nul
    goto :eof
    )
    
    for /f "tokens=2 delims=: " %%i in ('dism /english /get-wiminfo /wimfile:%1 /index:4 ^| find /i "Edition"') do set editionid=%%i
    IF %ERRORLEVEL% NEQ 0 (
    ECHO There is a problem reading the index edition id.
    echo.
    echo Press any key to exit.
    pause >nul
    goto :eof
    )
    
    for /f "tokens=1" %%i in ('dism /english /get-wiminfo /wimfile:%1 /index:4 ^| find /i "Default"') do set langid=%%i
    IF %ERRORLEVEL% NEQ 0 (
    ECHO There is a problem reading the index language id.
    echo.
    echo Press any key to exit.
    pause >nul
    goto :eof
    )
    
    set DVDLABEL=IR3_CCSA_%arch%FRER_%langid%_DV9
    if "%editionid%"=="CoreSingleLanguage" set DVDLABEL=IR3_CSLA_%arch%FRER_%langid%_DV9
    if "%editionid%"=="ProfessionalWMC" set DVDLABEL=IR3_CPWMCA_%arch%FRER_%langid%_DV9
    if "%editionid%"=="CoreCountrySpecific" set DVDLABEL=IR3_CCCSA_%arch%FRER_%langid%_DV9
    if "%editionid%"=="Core" set DVDLABEL=IR3_CCOA_%arch%FRER_%langid%_DV9
    if "%editionid%"=="Professional" set DVDLABEL=IR3_CPRA_%arch%FRER_%langid%_DV9
    
    :MAINMENU
    cls
    ECHO ===============================================================================
    ECHO.                          ESD DECRYPTION SCRIPT
    ECHO ===============================================================================
    ECHO.                   1 - Decrypt and export to install.esd
    ECHO.                   2 - Decrypt and create install.wim
    ECHO.                   3 - Create Full ISO with install.esd
    ECHO.                   4 - Create Full ISO with install.wim
    ECHO ===============================================================================
    ECHO.                            Press 'Q' to Quit
    ECHO ===============================================================================
    
    choice /c 1234q /n /m "Choose a menu option, or Q to quit: "
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP%==1 GOTO :Selection1
    IF %ERRORTEMP%==2 GOTO :Selection2
    IF %ERRORTEMP%==3 GOTO :Selection3
    IF %ERRORTEMP%==4 GOTO :Selection4
    IF %ERRORTEMP%==5 GOTO :QUIT
    GOTO :MAINMENU
    
    :Selection1
    cls
    IF EXIST "%CD%\install.esd" (
    ECHO ===============================================================================
    ECHO.  An install.esd file is already present in the current folder.
    ECHO ===============================================================================
    ECHO.
    echo Press any key to exit.
    pause >nul
    GOTO :QUIT
    )
    Echo.
    CALL :DECRYPT
    ECHO ===============================================================================
    Echo Exporting ESD Index 4 to a new install.esd
    ECHO ===============================================================================
    dism /export-image /sourceimagefile:"%ENCRYPTEDESD%" /Sourceindex:4 /destinationimagefile:install.esd /compress:recovery /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.)
    echo.
    echo Press any key to exit.
    pause >nul
    GOTO :QUIT
    
    :Selection2
    cls
    IF EXIST "%CD%\install.wim" (
    ECHO ===============================================================================
    ECHO.  An install.wim file is already present in the current folder.
    ECHO ===============================================================================
    ECHO.
    echo Press any key to exit.
    pause >nul
    GOTO :QUIT
    )
    
    Echo.
    CALL :DECRYPT
    CALL :VHDINIT
    ECHO ===============================================================================
    Echo Applying ESD Index 4 to a VHD for re-capture.
    ECHO ===============================================================================
    dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:4 /applydir:Z:\ /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
    ECHO ===============================================================================
    ECHO Capturing the applied image back to a new install.wim.
    ECHO ===============================================================================
    imagex /capture /flags "%editionid%" /check /compress maximum Z:\ install.wim %WINDOWSNAME% %WINDOWSNAME%
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during imagex capture.)
    ECHO.
    echo Press any key to exit.
    pause >nul
    GOTO :QUIT
    
    :Selection3
    cls
    Echo.
    CALL :DECRYPT
    ECHO.
    ECHO ===============================================================================
    ECHO Creating ISO structure folder...
    ECHO ===============================================================================
    IF EXIST ISOFOLDER\ RD /s /q ISOFOLDER\
    MKDIR ISOFOLDER
    dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:1 /applydir:ISOFOLDER\ /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
    del ISOFOLDER\MediaMeta.xml
    ECHO.
    ECHO ===============================================================================
    ECHO Creating boot.wim file...
    ECHO ===============================================================================
    ECHO.
    CALL :VHDINIT
    ECHO ===============================================================================
    Echo Applying ESD Index 2 to a VHD for re-capture.
    ECHO ===============================================================================
    dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:2 /applydir:Z:\ /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Capturing the applied image back to a new boot.wim.
    ECHO ===============================================================================
    imagex /capture /flags "9" /check /compress maximum Z:\ ISOFOLDER\sources\boot.wim "Microsoft Windows PE (%arch%)" "Microsoft Windows PE (%arch%)"
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during imagex capture.&PAUSE&GOTO :QUIT)
    
    CALL :VHDCLEAN
    ECHO ===============================================================================
    Echo Applying ESD Index 3 to a VHD for re-capture.
    ECHO ===============================================================================
    dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:3 /applydir:Z:\ /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Appending the applied image back to boot.wim.
    ECHO ===============================================================================
    imagex /append /flags "2" /check /boot Z:\ ISOFOLDER\sources\boot.wim "Microsoft Windows Setup (%arch%)" "Microsoft Windows Setup (%arch%)"
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during imagex capture.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Creating install.esd file...
    ECHO ===============================================================================
    dism /export-image /sourceimagefile:%1 /Sourceindex:4 /destinationimagefile:ISOFOLDER\sources\install.esd /compress:recovery /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism export.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Creating ei.cfg file...
    ECHO ===============================================================================
    ECHO.
    echo [EditionID] >ISOFOLDER\sources\EI.CFG
    echo %editionid% >>ISOFOLDER\sources\EI.CFG
    echo [Channel] >>ISOFOLDER\sources\EI.CFG
    echo Retail >>ISOFOLDER\sources\EI.CFG
    echo [VL] >>ISOFOLDER\sources\EI.CFG
    echo 0 >>ISOFOLDER\sources\EI.CFG
    ECHO.
    ECHO ===============================================================================
    ECHO Creating ISO file...
    ECHO ===============================================================================
    oscdimg.exe -bootdata:2#p0,e,b"ISOFOLDER\boot\etfsboot.com"#pEF,e,b"ISOFOLDER\efi\Microsoft\boot\efisys.bin" ^
    -o -h -m -u2 -udfver102 ^
    -t03/18/2014,09:09:28 -g ^
    -l%DVDLABEL% ^
    ISOFOLDER ^
    %DVDLABEL%.iso
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during ISO creation.)
    Echo.
    echo Press any key to exit.
    pause >nul
    GOTO :QUIT
    
    :Selection4
    cls
    Echo.
    CALL :DECRYPT
    ECHO.
    ECHO ===============================================================================
    ECHO Creating ISO structure folder...
    ECHO ===============================================================================
    IF EXIST ISOFOLDER\ RD /s /q ISOFOLDER\
    MKDIR ISOFOLDER
    dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:1 /applydir:ISOFOLDER\ /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
    del ISOFOLDER\MediaMeta.xml
    ECHO.
    ECHO ===============================================================================
    ECHO Creating boot.wim file...
    ECHO ===============================================================================
    ECHO.
    CALL :VHDINIT
    ECHO ===============================================================================
    Echo Applying ESD Index 2 to a VHD for re-capture.
    ECHO ===============================================================================
    dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:2 /applydir:Z:\ /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Capturing the applied image back to a new boot.wim.
    ECHO ===============================================================================
    imagex /capture /flags "9" /check /compress maximum Z:\ ISOFOLDER\sources\boot.wim "Microsoft Windows PE (%arch%)" "Microsoft Windows PE (%arch%)"
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during imagex capture.&PAUSE&GOTO :QUIT)
    
    CALL :VHDCLEAN
    ECHO ===============================================================================
    Echo Applying ESD Index 3 to a VHD for re-capture.
    ECHO ===============================================================================
    dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:3 /applydir:Z:\ /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Appending the applied image back to boot.wim.
    ECHO ===============================================================================
    imagex /append /flags "2" /check /boot Z:\ ISOFOLDER\sources\boot.wim "Microsoft Windows Setup (%arch%)" "Microsoft Windows Setup (%arch%)"
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during imagex capture.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Creating install.wim file...
    ECHO ===============================================================================
    ECHO.
    CALL :VHDCLEAN
    ECHO ===============================================================================
    Echo Applying ESD Index 4 to a VHD for re-capture.
    ECHO ===============================================================================
    dism /apply-image /imagefile:"%ENCRYPTEDESD%" /index:4 /applydir:Z:\ /checkintegrity
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during dism apply.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Capturing the applied image back to a new install.wim.
    ECHO ===============================================================================
    imagex /capture /flags "%editionid%" /check /compress maximum Z:\ ISOFOLDER\sources\install.wim %WINDOWSNAME% %WINDOWSNAME%
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during imagex capture.&PAUSE&GOTO :QUIT)
    ECHO.
    ECHO ===============================================================================
    ECHO Creating ISO file...
    ECHO ===============================================================================
    oscdimg.exe -bootdata:2#p0,e,b"ISOFOLDER\boot\etfsboot.com"#pEF,e,b"ISOFOLDER\efi\Microsoft\boot\efisys.bin" ^
    -o -h -m -u2 -udfver102 ^
    -t03/18/2014,09:09:28 -g ^
    -l%DVDLABEL% ^
    ISOFOLDER ^
    %DVDLABEL%.iso
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (ECHO.&Echo Errors were reported during ISO creation.)
    Echo.
    echo Press any key to exit.
    pause >nul
    GOTO :QUIT
    
    :QUIT
    CALL :VHDKILL
    IF EXIST ISOFOLDER\ RD /s /q ISOFOLDER\
    IF EXIST %ENCRYPTEDESD%.bak (
    del /f /q %ENCRYPTEDESD% >nul 2>&1
    ren %ENCRYPTEDESD%.bak %ENCRYPTEDESD%
    )
    exit /b
    
    :VHDKILL
    IF EXIST %VDISK% (
    echo select vdisk file=%VDISK% >vhd.dps
    echo detach vdisk >>vhd.dps
    echo exit >>vhd.dps
    %windir%\system32\diskpart.exe /s vhd.dps >nul
    del /f /q %VDISK%
    del /f /q vhd.dps)
    exit /b
    
    :VHDINIT
    CALL :VHDKILL
    echo create vdisk file=%VDISK% maximum=20000 type=expandable noerr >vhd.dps
    echo select vdisk file=%VDISK% >>vhd.dps
    echo attach vdisk >>vhd.dps
    echo create partition primary >>vhd.dps
    echo format fs=ntfs quick >>vhd.dps
    echo assign letter=Z >>vhd.dps
    echo exit >>vhd.dps
    %windir%\system32\diskpart.exe /s vhd.dps >nul
    
    SET ERRORTEMP=%ERRORLEVEL%
    IF %ERRORTEMP% NEQ 0 (
    ECHO ===============================================================================
    ECHO. There is a problem Creating a VHD to work with.
    ECHO. PRESS ANY KEY TO EXIT.
    ECHO ===============================================================================
    pause >nul
    GOTO :QUIT) ELSE (
    ECHO ===============================================================================
    ECHO.            * VHD ASSIGNED SUCCESSFULLY. Please ignore Autorun. *
    ECHO ===============================================================================
    ECHO.
    exit /b)
    
    :VHDCLEAN
    echo select vdisk file=%VDISK% >vhd.dps
    echo detach vdisk NOERR >>vhd.dps
    echo attach vdisk >>vhd.dps
    echo clean >>vhd.dps
    echo create partition primary >>vhd.dps
    echo format quick fs=NTFS >>vhd.dps
    echo assign letter=Z >>vhd.dps
    echo exit >>vhd.dps
    %windir%\system32\diskpart.exe /s vhd.dps >nul
    del /f /q vhd.dps
    exit /b
    
    :DECRYPT
    IF DECRYPTED NEQ 1 (
    if not exist %ENCRYPTEDESD%.bak (
    Echo Backing up original esd file...
    copy %ENCRYPTEDESD% %ENCRYPTEDESD%.bak >nul)
    ECHO.
    Echo Running Decryption program...
    ECHO.
    esddecrypt %ENCRYPTEDESD%
    SET DECRYPTED=1
    )
    exit /b
    
     
  2. SkyLK

    SkyLK MDL Novice

    Apr 24, 2008
    21
    14
    0
    forums.mydigitallife.net/threads/53855-Windows-8-1-with-Update-ESDs-Repository
     
  3. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    Only WIM > ESD possible :g:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. liliactr

    liliactr MDL Member

    Sep 3, 2009
    202
    83
    10
    #4 liliactr, Apr 16, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I do not want to work on microsoft encypted esd. i want to convert user created esd <> wim. i do not want to create iso also.

    esd to wim is also possible. new dism can apply an esd to a folder. thats why vhd routines. my batch also should have vhd routines. Maybe when executed inside a folder it can looks for a install.esd or install.wim. If it find and install.esd it convert it to install.wim. If it find install.wim it can convert it to install.esd with.

    Code:
    for /l %%x in (1, 1, 4) do (dism /export-image /sourceimagefile:%path%\install.wim /sourceindex:%%x /destinationimagefile:%path%\install.esd /compress:recovery
    )
    
    something like that
     
  5. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,394
    11,615
    240
    #5 murphy78, Apr 16, 2014
    Last edited by a moderator: Apr 20, 2017
    There's no official method to convert esd to wim. We use vhd and apply/capture techniques for the esd iso script.
    You're welcome to look at the script for yourself, but be warned that it's actually moderately complicated to do it correctly.

    To convert from wim to esd is really easy:
    Code:
    for /l %%x in (1, 1, 9) do (
    dism /export-image /sourceimagefile:c:\win81\sources\install.wim /sourceindex:%%x /destinationimagefile:c:\win81\sources\install.esd /compress:recovery
    )
    del /q /f c:\win81\sources\install.wim
    9 is the number of indexes. change for your actual number.
     
  6. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    Yeah, you can apply and recapture but not convert easily.



    Nice understatement :good3:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. liliactr

    liliactr MDL Member

    Sep 3, 2009
    202
    83
    10
    apply and capture part is very easy with murphy78 method. i know it will take time. my problem is not with time. my problem is only with automating it.
     
  8. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,394
    11,615
    240
    Yah well don't say I didn't warn you :biggrin:
     
  9. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,141
    84,318
    340
    #9 abbodi1406, Apr 17, 2014
    Last edited: Nov 25, 2021
    ESD2WIM-WIM2ESD

    # Info #
    An automated script to convert Solid-compressed ESD file to a Regular-compressed WIM file and vice versa
    the script is ment for custom made install.esd or already decrypted ESD files.

    # How To Use #
    - Temporary disable AV or protection program so it doesn't interfere with the process.

    - Make sure the ESD file is not read-only or blocked.

    - Extract this pack to a folder with simple path to avoid troubles (example: C:\ESD).

    - You may start the process using any of these ways:
    # Copy/Move install.esd or install.wim file next to the script, then run convert.cmd

    # Drag & drop the file on convert.cmd

    # Run convert.cmd and you will be prompted to enter the file path

    # Open command prompt in the script folder, and execute: convert FileNameAndPath
    this method allow you to use ESD/WIM file from any location.
    examples:
    convert install.wim
    convert "C:\Win8.1 ISO\sources\install.esd"
    convert C:\RecoveryImage\install.esd

    - You will have these options (varies depending on the number of indexes):
    0 - Quit
    1 - Export single index
    2 - Export all indexes
    3 - Export consecutive range of indexes
    4 - Export randomly selected indexes

    this option will be available only with administrator privileges:
    5 - Apply single index to another drive

    # Notes #
    - When converting WIM to Solid ESD, the process will consume very high amount of CPU and RAM resources
    if your machine specifications are not powerful enough, the operation will substantially paralyze your system.

    - If you are converting ESD to WIM, make sure there is no install.wim file present in the script's directory.

    - To use option 5, you must run convert.cmd 'as administrator'
    during applying, you may see "[WARNING] Failed to enable short name support", you can safely ignore it.

    # Download #

    - Based on wimlib-imagex utility created by synchronicity (Eric Biggers)
    - Works on Windows XP environment and later.
    - Faster/Produce slightly smaller size compared to DISM.

    Code:
       File: ESD2WIM-WIM2ESD-8.zip
      SHA-1: 4db316edf7f50aef75e08af7f3f15fafd7a4414f
    SHA-256: 3e03bf79ebd7992c6f1663380d58a002e3127aa0a276c7d3f4dbdff2d190c123
    
    https://github.com/abbodi1406/WHD/raw/master/scripts/ESD2WIM-WIM2ESD-8.zip
    https://download.ru/files/4i1dpnBL
    https://host-a.net/f/310471-esd2wim-wim2esd-8zip
    Older:
    Code:
      File: ESD2WIM-WIM2ESD-7.zip
      SHA1: 2109C768AE4213CE8C367D4478519C632587C304
    SHA256: E944AFEECCFB9702FAD34955164318216FB67D82664B4ADC327059223FF3F124
    
    https://github.com/abbodi1406/WHD/raw/master/scripts/ESD2WIM-WIM2ESD-7.zip
    https://cloud.mail.ru/public/JdHf/gfmbjoNVx
    http://www.mirrorcreator.com/files/1AI10G13
    Code:
    File: ESD2WIM-WIM2ESD-6.zip
     MD5: 0f5eba6ddde634e2d25065877bb01d0d
    SHA1: 661e265127fdd515e823efeab54abb6a7c64de1a
    
    Download | Mail.Ru | Mega | Mirrors
    Code:
    File: ESD2WIM-WIM2ESD-5.zip
     MD5: 1daa141e09c19b5a0d3e2896e225af7a
    SHA1: 3439d23e0b7335266df30227ee7980392690d693
    
    Download | Mirror | Mirrors
    Code:
    File: ESD2WIM-WIM2ESD-4.zip
     MD5: c1f2c625a896e5cb2e2efcca1c8bc6f7
    SHA1: 23252c0d50136e012b126455561e951a5adbb549
    
    Download
    Mirror
    Code:
    File: ESD2WIM-WIM2ESD-wimlib-3.7z
     MD5: 6737bcea44267180a0c234f6ba182ca5
    SHA1: 1071a5563721fe458e5cdc475faede35e7b4f5c5
    
    Download
    Code:
    File: ESD2WIM-WIM2ESD-wimlib-2.7z
     MD5: 60c2d8b78b48fc2f3ab850d5eac3beca
    SHA1: db0d0c8755b50fd1e5da5fdbad8b8354180840c2
    
    Download
    Mirror
    Code:
    File: ESD2WIM-WIM2ESD-wimlib.7z
     MD5: ff1b69777fdf9699214a952aa7b7943c
    SHA1: 694a430711300c21413c424dad75391d1c493f04
    Dev-Host
    files.fm



    - Based on Microsoft DISM tool.
    - Works on Windows 7 environment and later.

    Code:
    File: ESD2WIM-WIM2ESD-dism-2.7z
     MD5: b7b808a000f471ae87c555793f28608e
    SHA1: 2ccc6bfe5a9f579a84d7fd113ffb09c22e4d35f9
    
    Download | Mirror | Mirrors
    Older:
    Code:
    File: ESD2WIM-WIM2ESD-dism.7z
     MD5: d655e934646559052517c8bfb627d976
    SHA1: 6e983a0bf56393d472715a0a0ce86e38b9b9f91f
    Dev-Host
    files.fm
    Code:
    File: ESD2WIM-WIM2ESD-v2.7z
    SHA1: 40f4b1b5b4cc7ac2d14dd4e53849d3bcb5a89f35
    files.fm
    Dev-Host
     
  10. apologized

    apologized MDL Addicted

    Nov 29, 2012
    874
    507
    30
    useful script ....
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. generalmx

    generalmx MDL Novice

    Apr 15, 2014
    34
    21
    0
    #11 generalmx, Apr 21, 2014
    Last edited by a moderator: Apr 20, 2017
    I made scripts for my own experiments with unencrypted ESDs (to make install files smaller), feel free:

    exportesd.bat
    Code:
    @echo off
    :: Safely extracts and converts an ESD to a WIM
    :: By Gen 4-19-2014
    ::
    :: Usage 1: exportesd.bat "path/to/file/file.esd"
    :: Extracts all indexes from file.esd to install.wim.
    ::
    :: Usage 2: exportesd.bat "path/to/file/file.esd" #
    :: Extracts index # from file.esd to install.wim.
    ::
    :: Usage 3: exportesd.bat "path/to/file/file.esd" Start Stop
    :: Extracts indexes numbering from Start to Stop from file.esd to install.wim.
    ::
    SETLOCAL EnableDelayedExpansion
    
    set _tempdir=F:\TEMP
    set _mountdir=%_tempdir%\mount
    set _scratchdir=%_tempdir%\dism
    
    set _name=
    set _desc=
    
    set rnum=%RANDOM%
    set _start=1
    set _stop=99
    
    IF "%~1"=="" (
       echo Usage: file [index ^| start-index stop-index ]
       GOTO :quit
    )
    
    IF NOT EXIST "%~f1" (
       echo ERROR: [%~f1] does not exist
       GOTO :quit
    )
    
    echo Working from [%~f1]...
    
    IF NOT [%3]==[] GOTO :startloop
    IF [%2]==[] GOTO :startloop
    
    :: Just export a single index
    call :getinfo "%~1" %2
    IF [!_name!]==[] (
       call :errorlog "ERROR: Problem with getting name from index [%2] of [%~f1]"
       GOTO :cleanup
    )
    call :extracttowim "%~1" %2
    GOTO :done
    
    :startloop
    IF NOT [%3]==[] (
       set _start=%2
       set _stop=%3
    )
    echo Starting at index [!_start!] and stopping at or before [!_stop!]
    FOR /L %%I in (!_start!,1,!_stop!) DO (
          echo Processing index [%%I]...
          call :getinfo "%~1" %%I
          IF [!_name!]==[] GOTO :done
          call :extracttowim "%~1" %%I
       )
    )
    GOTO :done
    
    :errorlog
    echo %~1
    echo %~1 >> "%_tempdir%\errors_%rnum%.txt"
    GOTO :eof
    
    :getinfo
    set _name=
    set _desc=
    dism /get-wiminfo /wimfile:"%~f1" /index:%2 > "%_tempdir%\%~n0_%rnum%.txt"
    FOR /f "tokens=2* delims=:" %%G in ('findstr /C:"Name" "%_tempdir%\%~n0_%rnum%.txt"') DO (
       set _name=%%G
    )
    IF NOT [!_name!]==[] ( 
       set _name=!_name:~1!
    ) ELSE (
       call :errorlog "WARNING: Problem with getting name from index [%2] of [%~f1]"
    )
    FOR /f "tokens=2* delims=:" %%G in ('findstr /C:"Description" "%_tempdir%\%~n0_%rnum%.txt"') DO (
       set _desc=%%G
    )
    IF NOT [!_desc!]==[] ( 
       set _desc=!_desc:~1!
    ) ELSE (
       call :errorlog "WARNING: Problem with getting description from index [%2] of [%~f1]"
    )
    GOTO :eof
    
    :extracttowim
    mkdir "%_mountdir%"
    echo Extracting index [%2] [!_name!] of [%~f1]...
    dism /get-wiminfo /wimfile:"%~f1" /index:%2 >Nul && dism /apply-image /imagefile:"%~f1" /index:%2 /applydir:"%_mountdir%" /scratchdir:"%_scratchdir%" /checkintegrity && dism /capture-image /imagefile:"%_tempdir%\temp_%rnum%.wim" /compress:none /capturedir:"%_mountdir%" /name:"!_name!" /description:"!_desc!" /checkintegrity /verify && takeown /F "%_mountdir%" /R /D Y /SKIPSL >Nul && icacls "%_mountdir%" /T /C /L /Q /grant Superuser:(F) >Nul && rd "%_mountdir%" /q/s >Nul
    IF EXIST "%_tempdir%\temp_%rnum%.wim" (
       dism /export-image /sourceimagefile:"%_tempdir%\temp_!rnum!.wim" /sourceindex:1 /destinationimagefile:"%_tempdir%\install.wim" /checkintegrity /compress:max
       echo Y | del "%_tempdir%\temp_!rnum!.wim" >Nul
    ) ELSE (
       call :errorlog "ERROR: [%_tempdir%\temp_!rnum!.wim] doesn't seem to exist, aborting"
       call :errorlog "ERROR: Aborted on index [%2] of [%~f1]"
       GOTO :cleanup
    )
    IF EXIST "%_mountdir%" (
       call :errorlog "ERROR: Mount directory not clean, aborting"
       call :errorlog "ERROR: Aborted on index [%2] of [%~f1]"
       GOTO :cleanup
    )
    GOTO :eof
    
    :done
    echo Task on [%~f1] complete.
    :cleanup
    echo Y | del "%_tempdir%\%~n0_!rnum!.txt" >Nul
    echo Y | del "%_tempdir%\temp_!rnum!.wim" >Nul
    
    :quit
    

    converttoesd.bat
    Code:
    @echo off
    :: Safely extracts and converts a WIM to a ESD
    :: By Gen 4-20-2014
    ::
    :: Usage 1: converttoesd.bat "path/to/file/file.wim"
    :: Extracts all indexes from file.wim to install.esd.
    ::
    :: Usage 2: converttoesd.bat "path/to/file/file.esd" Start Stop
    :: Extracts indexes numbering from Start to Stop from file.wim to install.esd.
    ::
    SETLOCAL EnableDelayedExpansion
    
    set _tempdir=F:\TEMP
    set _mountdir=%_tempdir%\mount
    set _scratchdir=%_tempdir%\dism
    
    set _name=
    set _desc=
    
    set rnum=%RANDOM%
    set _start=1
    set _stop=99
    
    IF "%~1"=="" (
       echo Usage: file [start-index stop-index ]
       GOTO :quit
    )
    
    IF NOT EXIST "%~f1" (
       echo ERROR: [%~f1] does not exist
       GOTO :quit
    )
    
    echo Working from [%~f1]...
    
    :startloop
    IF NOT [%3]==[] (
       set _start=%2
       set _stop=%3
    )
    echo Starting at index [!_start!] and stopping at or before [!_stop!]
    FOR /L %%I in (!_start!,1,!_stop!) DO (
          echo Processing index [%%I]...
          call :getinfo "%~1" %%I
          IF [!_name!]==[] GOTO :done
          call :extracttoesd "%~1" %%I
       )
    )
    GOTO :done
    
    :errorlog
    echo %~1
    echo %~1 >> "%_tempdir%\errors_%rnum%.txt"
    GOTO :eof
    
    :getinfo
    set _name=
    set _desc=
    dism /get-wiminfo /wimfile:"%~f1" /index:%2 > "%_tempdir%\%~n0_%rnum%.txt"
    FOR /f "tokens=2* delims=:" %%G in ('findstr /C:"Name" "%_tempdir%\%~n0_%rnum%.txt"') DO (
       set _name=%%G
    )
    IF NOT [!_name!]==[] ( 
       set _name=!_name:~1!
    ) ELSE (
       call :errorlog "WARNING: Problem with getting name from index [%2] of [%~f1]"
    )
    FOR /f "tokens=2* delims=:" %%G in ('findstr /C:"Description" "%_tempdir%\%~n0_%rnum%.txt"') DO (
       set _desc=%%G
    )
    IF NOT [!_desc!]==[] ( 
       set _desc=!_desc:~1!
    ) ELSE (
       call :errorlog "WARNING: Problem with getting description from index [%2] of [%~f1]"
    )
    GOTO :eof
    
    :extracttoesd
    mkdir "%_mountdir%"
    echo Extracting index [%2] [!_name!] of [%~f1]...
    dism /get-wiminfo /wimfile:"%~f1" /index:%2 >Nul && dism /export-image /sourceimagefile:"%~f1" /sourceindex:%2 /destinationimagefile:"%_tempdir%\install.esd" /checkintegrity /compress:recovery || call :errorlog "ERROR: Error exporting [%2] for [%~f1]"
    GOTO :eof
    
    :done
    echo Task on [%~f1] complete.
    :cleanup
    echo Y | del "%_tempdir%\%~n0_!rnum!.txt" >Nul
    
    :quit
    
     
  12. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,770
    1,101
    60
    What about using exclusion lists during recapture.
     
  13. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,141
    84,318
    340
    ESD2WIM-WIM2ESD

    updated to incorporate the new export method, eliminating the need for vhd or apply/capture process to convert wim2esd

    i also added menu(s) to select what to export: 1st/single/multiple/all indexes

    thanks to generalmx for the idea
     
  14. moonwalker698

    moonwalker698 MDL Novice

    Oct 17, 2013
    21
    12
    0
    #14 moonwalker698, Apr 30, 2014
    Last edited: Apr 30, 2014
    Hi Guys,

    I was playing with the ESD2WIM-WIM2ESD script, but I get an error number 13.

    Here are part of my dism.log

    Maybe someone have a solution?

    Thanks in advance.
     
  15. EFA11

    EFA11 Avatar Guru

    Oct 7, 2010
    8,719
    6,741
    270
    the log is saying that it is sad, see the sad smileys?
     
  16. moonwalker698

    moonwalker698 MDL Novice

    Oct 17, 2013
    21
    12
    0
    Ok, smileys removed
     
  17. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,141
    84,318
    340
    The error suggest an Access Denied or some permissions are tampered or not aquired

    in what phase or option you get the error?
     
  18. liliactr

    liliactr MDL Member

    Sep 3, 2009
    202
    83
    10
    #18 liliactr, May 2, 2014
    Last edited: May 2, 2014
    (OP)
    There are some bugs in first version. On ESD2WIM-WIM2ESD.7z. I have not checked ESD2WIM-WIM2ESD-v2.7z yet.

    Forexample

    Should be

    Also same mistake on apply and capture esd menu. I see that you removed the first script.

    I fixed all i can do but there is error about flags. Can you check it

    BX22lg.jpg

    http://www.datafilehost.com/d/acf86f17
     
  19. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,141
    84,318
    340
    First version is obsolete :rolleyes:
     
  20. moonwalker698

    moonwalker698 MDL Novice

    Oct 17, 2013
    21
    12
    0
    Thanks for your question/help.

    I was using version 2. After entering the name of the file, I choose to convert all indexes. Then I get error 13 after some seconds.
    After trying a couple f times, I have removed everything. I have not so much time for experimenting during the week.

    This weekend, I will take a look of some solutions above. :)