I have a bootable flash drive with a WINPE install on it, and I would like to be able to convert said bootable usb to an iso file from a batch or powershell file. I've tried using tools like Folder2iso, but it does not support creating an iso file that is bootable. ImgBurn seemed promising but not matter how much I mess with the config, the iso never boots, plus it is not easy to make portable which is something I need for the program I am creating.
After doing some more digging, I can create an iso like this:
pushd C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg
xcopy "F:\" "%temp%\WinPECopy\media\"
xcopy "C:\WinPE_amd64\fwfiles" "%temp%\WinPECopy\fwfiles\"
"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\MakeWinPEMedia.cmd" /ISO "%temp%\WinPECopy" "C:\WinPE_Copy.iso"
But then I get the following error:
This is probably because I added the NET framework and custom files to the USB drive, but used the default unaltered efisys.bin file from C:\WinPE_amd64\fwfiles.
You can see this in the CreateWinPEMedia.cmd
file here:
:ISOWorker_OscdImgCommand
rem
rem Set the correct boot argument based on availability of boot apps
rem
set BOOTDATA=1#pEF,e,b"%WORKINGDIR%\%FWFILES%\efisys.bin"
if exist "%WORKINGDIR%\%FWFILES%\etfsboot.com" (
set BOOTDATA=2#p0,e,b"%WORKINGDIR%\%FWFILES%\etfsboot.com"#pEF,e,b"%WORKINGDIR%\%FWFILES%\efisys.bin"
)
rem
rem Create the ISO file using the appropriate OSCDImg command
rem
echo Creating %DEST%...
echo.
oscdimg -bootdata:%BOOTDATA% -u1 -udfver102 "%WORKINGDIR%\%TEMPL%" "%DEST%" >NUL
if errorlevel 1 (
echo ERROR: Failed to create "%DEST%" file.
goto fail
)
Anyone know how I can get around this? I tried deleting the etfsboot.com
file since it seems to handle whether or not the file is there, but then I get the Failed to boot: No bootable medium found.
error.
Another update
I think I'm on to something, as I figure this out I'm seeing that this is sort of an XY question (pointed out by @Biswapriy). I think I can make it not an XY question but I have to do a bit more research first.
So far I'm thinking:
setps:
1. Mount the USB Drive
2. Copy everything to a folder (backup2 script)
3. unmount the usb drive
4. Create new WinPE base: copype amd64 C:\WinPE_ISO_START
5. mount the new image: dism /Mount-Image /ImageFile:"C:\WinPE_ISO_START\media\boot.wim" /index:1 /MountDir:"C:\WinPE_ISO_START\mount"
6. restore from the copy
7. Unmount the image: dism /Unmount-Image /MountDir:"C:\WinPE_ISO_START\mount: /commit
8. Create the iso: makewinpemedia /iso "C:\WinPE_ISO_START" "C:\Changed iso.iso"
Best Answer
(mine is: C:\TempPath\WindowsImages\ExtractedOriginalISO\Windows10)
Dism /Unmount-Image /MountDir:C:\TempPath\Mount /Commit
Open Deployment Imaging tool as Admin
Run Command: