ESD converter not working anymore

Discussion in 'Windows 11' started by yolo_twice, Nov 3, 2022.

  1. yolo_twice

    yolo_twice MDL Novice

    Jul 15, 2015
    20
    5
    0
    I've been using this approach since early Windows 10 days but it doesn't work for Windows 11. Any idea how to fix it?

    I don't remember where I got the scripts from and I'm not the author.

    extract-esd-to-folder.ps1


    Code:
    $ESDFilePath="file.esd"
    
    $ImageExclusions=@(
        'Windows Setup Media'
        'Microsoft Windows PE (x64)'
        'Microsoft Windows Setup (x64)'
        'Microsoft Windows PE (x86)'
        'Microsoft Windows Setup (x86)'
    )
    
    $AllImages=Get-WindowsImage -ImagePath $ESDFilePath
    $SetupMediaImage=$AllImages.Where({$_.ImageName -eq "Windows Setup Media"})
    $SetupImage=$AllImages.Where({$_.ImageName -eq "Microsoft Windows Setup (x64)"})
    
    New-Item -Path ".\ISOFiles" -ItemType Directory
    Expand-WindowsImage -ImagePath $ESDFilePath -Index $SetupMediaImage.ImageIndex -ApplyPath ".\ISOFiles"
    
    Export-WindowsImage -SourceImagePath $ESDFilePath -SourceIndex $SetupImage.ImageIndex -CompressionType Maximum -DestinationImagePath ".\ISOFiles\Sources\boot.wim" -DestinationName $SetupImage.ImageName
    
    $AllImages.Where({$_.ImageName -notin $ImageExclusions}).foreach(
        {
            Export-WindowsImage -SourceImagePath $ESDFilePath -SourceIndex $_.ImageIndex -CompressionType Maximum -DestinationImagePath ".\ISOFiles\Sources\Install.wim" -DestinationName $_.ImageName
        }
    )
    create-iso-from-folder.ps1
    Code:
    $ISOMediaFolder = 'D:\ISOFiles'
    $ISOFile = 'D:\my.iso'
    $PathToOscdimg = 'D:\WindowsKits10ADK\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg'
    $BootData='2#p0,e,b"{0}"#pEF,e,b"{1}"' -f "$ISOMediaFolder\boot\etfsboot.com","$ISOMediaFolder\efi\Microsoft\boot\efisys_noprompt.bin"
    Start-Process -FilePath "$PathToOscdimg\oscdimg.exe" -ArgumentList @("-bootdata:$BootData",'-u2','-udfver102',"$ISOMediaFolder","$ISOFile") -PassThru -Wait -NoNewWindow
    
    Then burn the ISO with the latest Rufus.

    In multiple computers I get the same error:

     
  2. TigTex

    TigTex MDL Senior Member

    Oct 5, 2009
    451
    358
    10
    abbodi1406 has a tool that does that (and much more). Give it a try
     
  3. yolo_twice

    yolo_twice MDL Novice

    Jul 15, 2015
    20
    5
    0
    I appreciate the link but I don't trust third party tools with no source or blobs (no offense intended! you're all great) that's why I searched for the script a few years ago.
    Just trying to check if someone knows the reason or had the same issue :(
     
  4. TigTex

    TigTex MDL Senior Member

    Oct 5, 2009
    451
    358
    10
    You can just right click on it and open with notepad. It's a simple batch file
     
  5. yolo_twice

    yolo_twice MDL Novice

    Jul 15, 2015
    20
    5
    0
    It calls several executables from the /bin folder that I don't have the source to.
     
  6. yolo_twice

    yolo_twice MDL Novice

    Jul 15, 2015
    20
    5
    0
    FIXED

    The problem was that the image names changed.

    To see the new names you can use
    Code:
    Write-Output $AllImages
    exit
    e.g. Microsoft Windows Setup (x64) changed to Microsoft Windows Setup (amd64)

    The errors were being silenced for some reason.
     
  7. garf02

    garf02 MDL Member

    Sep 15, 2007
    181
    68
    10
    Try whit this modify:

    extract-esd-to-folder.ps1

    Code:
    $ESDFilePath="file.esd"
    
    $ImageExclusions=@(
       'Windows Setup Media'
       'Microsoft Windows PE (amd64)'
       'Microsoft Windows Setup (amd64)'
       'Microsoft Windows PE (x86)'
       'Microsoft Windows Setup (x86)'
    )
    
    $AllImages=Get-WindowsImage -ImagePath $ESDFilePath
    $SetupMediaImage=$AllImages.Where({$_.ImageName -eq "Windows Setup Media"})
    $SetupImage=$AllImages.Where({$_.ImageName -eq "Microsoft Windows Setup (amd64)"})
    
    New-Item -Path ".\ISOFiles" -ItemType Directory
    Expand-WindowsImage -ImagePath $ESDFilePath -Index $SetupMediaImage.ImageIndex -ApplyPath ".\ISOFiles"
    
    Export-WindowsImage -SourceImagePath $ESDFilePath -SourceIndex $SetupImage.ImageIndex -CompressionType Maximum -DestinationImagePath ".\ISOFiles\Sources\boot.wim" -DestinationName $SetupImage.ImageName
    
    $AllImages.Where({$_.ImageName -notin $ImageExclusions}).foreach(
       {
           Export-WindowsImage -SourceImagePath $ESDFilePath -SourceIndex $_.ImageIndex -CompressionType Maximum -DestinationImagePath ".\ISOFiles\Sources\Install.wim" -DestinationName $_.ImageName
       }
    )
    
     
  8. yolo_twice

    yolo_twice MDL Novice

    Jul 15, 2015
    20
    5
    0
    Yeah that's what I did, I just updated the names after I got them from Write-Output $AllImages