43 - Install Windows 8, Server 2012, Win 7, 2K8 & Vista from multiple ISO files on the same Flash drive

tumblr analytics

New! To make a USB Flash drive to install Windows 7 and XP just by adding two iso files see the Easy2Boot Tutorial:

PLEASE TRY THIS! Easy2Boot - Easy2Boot allows you to add ALL and ANY .iso, .img, .ima, .gz files , all Linux LiveCD ISOs and Windows Install ISOs (XP through to Server 2012) to your USB drive and boot from any of them. Automatic menu system. Just copy over your files and boot - no special utility required, no linux cheat codes, no special knowledge. Fully documented. You can change the wallpaper, menu, change the language, text colours, etc. to suit you. 
Comments from users on forums about Easy2Boot:
nyquist - 'Easy2boot is awesome. Thanks for sharing this software with us.'
Rootman - 'This is one of the coolest things I've run across in a long time. You guys have GOT to check this out.'
maanu - please accept my congratulations on coding this beautiful tool.. my 1st experience was GREAT. it worked flawlessly on very 1st try (win8 64-bit install)
Jkplayschess - This is a fantastic tool! I rarely get excited about things, but I'm following the development of this closely!
sebus - The solution works VERY well indeed. Tested on W7 x64 so far 
Weedy - I gotta say I'm annoyed that this tool seems to work exactly as advertisedThis tool is a fantastic piece of software.


Please Note: As Windows 8/SVR2012 already contains most USB 3.0 drivers, Win8/SVR2012 ISOs will work even if the boot device is connected to a USB 3.0 port! Earlier OS's won't work on most USB 3.0 ports unless you first add the correct USB 3.0 drivers into the ISO file yourself.

Introduction

This method describes how you can place all your Windows Vista 32-bit/64-bit ISOs, Windows 7 32-bit/64-bit ISOs, Server 2K8 R2 ISOs, Win8 ISOs, etc. all on one (large) USB Flash drive and install any version of Windows onto any system whenever you like.

Windows 8 Note: for Windows 8, the xml file needs to contain the Product Key - see http://reboot.pro/14593/page__view__findpost__p__142622 for details (post #47 and #49).
Some temporary product keys (which will be accepted but won't activate) are detailed by Microsoft here.

This is a slightly neater alternative to tutorial #32 and uses FiraDisk.

Most of this is directly 'pinched' from a post by Karyonix (thanks!) on reboot.pro (this post) but I have added the AutoUnattend.xml file so that the process is completely automated if using a USB Flash drive.

All of the ISO files must be kept in one single folder (called \ISO in this example, but you can change it) and if you want the user choice menu to work, then the ISO folder must also contain a marker file called 'Choose_an_iso'. Note that the ISO folder that contains the ISO files and the special tag/marker file Choose_an_Iso can be on any drive (e.g. a hard disk or a USB hard disk). You can change the name of the folder or marker file if you like, as long as you also change the path and name in the menu or you can just use one of your iso files as the marker file and delete the 'Choose_an_iso' file so it is not listed when the iso files are listed on the screen.

Please note: Some new USB Flash drives are not the usual 'Removable' type but appear as 'Fixed Disk' in RMPrepUSB and 'Local Disk' in Windows Explorer - these flash drives will not work using this method as they will appear to Windows as a 'hard disk'. If you have this type of USB flash drive you will also need a USB 'Removable' Flash drive as well (treat the Fixed-Disk flash drive as if it were a hard disk).

Note: You can also add entries to install Windows XP as well as the other OS's. To install from a Setup CD (just like booting from an XP install CD) refer to Tutorial #30 here and add the files to those used in this tutorial or see Tutorial #63 which has instructions for both Win7 and XP and includes activation instructions.

History

Update 26 June 2011: Fixed 64-bit Windows ISO install which did not work, as devcon did not include an amd64 version and extraction of the x64-bit version is very awkward! The 64-bit version of devcon from the MS site KB article download (2003) does not actually run under 64-bit WinPE as it is an ia64 platform version!!! Please use the new version of my zip download which now includes both devcon versions (32&64).
Update 26 June 2011 (19:00 BST): Added an Addendum to support hard disks and included two new files in the tutorial download.
Updated 1st July 2011: Changed menu to not use wenv and use grub4dos variables instead, also now allows boot from BOOTMGR or non-ISO9660 iso files. New download Tut43_Fira_iso.zip
Updated 20th July 2011:  Typo in loadiso.cmd meant it reported devcon as missing - now fixed (thanks G R!).
Updated 10th August 2011: Sushil1576 from Reboot.pro has found the if X:\Setup.exe is run, you also get the repair option. This is useful for the Hard Disk version only - see Addendum section at the end of this page. The download has been updated with a new MySetup.cmd file so that the Repair option is offered.
Updated 12th September 2011:  Modification to add the 'Repair' option for all ISOs, so that no separate 'repair grub4dos' menu item is required
Updated 1st June 2012: Added two menu entries for Windows 8 Release Preview
Updated 4th July 2012: Added ImDisk as Server 2012 WinPE no longer works with FiraDisk. NOTE: You must add your own Product Key to the FiraDisk\xxx.xml files for Win8/SVR8.
Updated 25th Sept 2012: Delay added to allow detection of USB drive by OS and retries if no file found (thanks to Todd Fraser for reporting this)

Using this method with USB Hard Disks

The method described immediately below works if you use a USB Flash drive but does not work automatically for a single bootable USB hard disk because the AutoUnattend.xml file MUST be on a removable drive (i.e. a USB flash drive or CD). If you want to use a USB hard disk, you have the following 4 options:

1. Prepare a USB Flash drive (Removable type) as described below (without the ISO files) but copy all the ISO files to the USB hard disk /ISO folder (or onto a separate partition on the internal hard disk on the target system into a /ISO folder). If using two USB drives (USB Flash & USB HDD), make sure both the Flash drive and the USB hard drive are connected to the computer when you boot from your Flash drive. The only \Autounattend.xml should be on the Removable flash drive.
 - OR -
2. Prepare a USB hard drive by following the instructions below for a Flash drive. Then move the single AutoUnattend.xml file to any spare USB flash drive that you have - it must be of the Removable type. To install Windows, boot from the USB hard drive but make sure the USB Flash drive is also connected to the same system.
- OR -
3. Prepare a USB hard drive following the instructions for a Flash drive below. Boot from the USB hard drive and when Windows Setup loads, press SHIFT+F10 to open a command console and type F:\firadisk\loadiso  (where F: is the drive letter of your USB hard disk - which may vary depending on the system you are installing to).
 - OR -
4. See the Addendum below for how to modify each Windows Vista/7/2K8 ISO so that a single bootable USB hard drive can be used, without a flash drive being needed and without the need for the user typing in any extra commands.

Method (for USB Flash drives)

Note: these instructions also apply if you already have a bootable grub4dos disk, just extract the Tut43_FiraISO.zip contents onto it (note that it will overwrite your menu.lst though!) and copy all your ISO files to the USB drive and overwrite your grldr file with the recent one included in the latest version of RMPrepUSB v2.1.623 or later.

1. Create a new folder on your hard drive called C:\WINFira

2. Download the zip file Tut43_FiraIso.zip from the Beta Downloads - Tutorials page and extract the contents to the C:\WINFira folder

Contents of Tut43_FiraIso.zip:

AutoUnattend.xml
Menu.lst
\FiraDisk folder
au.xml
firadi64.cat
iradi64.sys
firadisk.cat
firadisk.inf
firadisk.sys
LOADISO.CMD
slp.exe
spaces.txt
wenv                (not used in this tutorial)
\i386\devcon.exe
\ia64\devcon64.exe
mysetup.cmd   (not actually used - see Addendum below)
winpeshl.ini      (not actually used - see Addendum below)
\ISO folder
Choose_an_iso
          <<<<<<<    (your iso files go here)


3. Now copy your Windows install ISO files to the C:\WinFira\ISO folder - Note: the iso filenames must NOT contain spaces!

You can download some Windows 7 ISOs from here. The Windows 8 Release Preview ISOs can be found here.

Notes: 
  • You must edit /firadisk/auWin8.xml with correct Product Key for Windows 8 install (if you use menu no. 4)!

  • Menus 5 and 6 f for Win8 allow you to use any Product Key and thus install any version. Do NOT change the auWin8.xml file - it must have a key starting with TK8TP-.

4. The sample menu.lst contains 5 (0-4) menu entries. The first menu entry is set to boot a fixed iso name. Just copy the first menu entry to make as many more as you like for all your ISO files. The second menu entry is merely to allow you to reboot to your hard disk after Windows has been installed onto it. The 3rd menu entry allows the user to choose which iso to boot to, by getting the user to type in the name of the iso that they want to use (note: does not work with Win8 ISOs). The last two menu entries are for Win 8 RP. You can delete any menu entries that you do not require.

New: Note that menu number 5 is not included in the download of menu.lst - this is a new menu which prompts the user for a Windows 8 Product Key before Windows Setup is run.

Edit the menu.lst and change the first line (title) and 3rd line (ISO filename) in each menu, the sample menu included in the download, is shown below:



#       NORMAL     HIGHLIGHT     HELPTEXT        HEADING    in pairs consisting of foreground/background
color black/cyan    blue/cyan        red/light-blue     red/cyan

# display this heading
write (md)0x220+1 !BAT\necho -n -P:0000 $[0133]                    --- Windows install ---                                    \0
initscript (md)0x220+1

title 1 INSTALL Windows 7 32-bit\nThis will install any edition of Windows 32-bit to your hard disk
debug off
set MYISO=win7.iso
find --set-root /AutoUnattend.xml
dd if=(bd)/firadisk/au.xml of=()/AutoUnattend.xml
dd if=(bd)/firadisk/spaces.txt of=()/firadisk/ISONAME.CMD
root (bd)
write (bd)/firadisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\n
map --mem (md)0x800+4 (99)
echo Mapping /ISO/%MYISO% as an optical drive...
map /ISO/%MYISO% (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
write (99) [FiraDisk]\nStartOptions=cdrom,vmem=find:/ISO/%MYISO%;\n\0
chainloader (0xff)/BOOTMGR || chainloader (0xff)

### ADD MORE ISO MENU ENTRIES HERE - DUPLICATE THE ENTRY ABOVE AND CHANGE THE ISO FILENAME

title
root ()

title 2 Boot from 1st Hard Disk \nBoot from MBR of first hard disk and remove the USB drive
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)

title 
root ()

title Choose any iso file...
root ()

title 3 INSTALL WINDOWS VISTA/7 - Boot from any Windows ISO to install Windows\nThis menu allows you to type in the name of any Windows ISO file and boot from it
# find the ISO folder by looking for a marker file
debug off
find --set-root /ISO/choose_an_iso
clear
echo
# list all files in the /ISO folder so the user can see them
ls ()/ISO/
echo
# Ask user which iso they want (name is converted to uppercase as /u is specified)
set /p /u ask=Enter iso filename WITH NO .ISO EXTENSION (e.g. Win7Pro32 ) :  
if "%ask%"=="" echo No iso file specified! && configfile /menu.lst
clear
# check if user entered a valid filename with no ISO extension!
ls /ISO/%ask%.iso || echo Cannot find /ISO/%ask%.iso !!! && pause --wait=3 && configfile (bd)/menu.lst
echo Loading /ISO/%ask%.iso - please wait ...
#set root drive to USB stick
find --set-root /Autounattend.xml
map --mem (md)0x800+4 (99)
dd if=(bd)/firadisk/au.xml of=()/AutoUnattend.xml
dd if=(bd)/firadisk/spaces.txt of=()/firadisk/ISONAME.CMD
root (bd)
write ()/firadisk/ISONAME.CMD SET MYISO=\\iso\\%ask%.iso\r\n
find --set-root /ISO/%ask%.iso
# run the grub4dos map command and specify the iso file we want to load
map /ISO/%ask%.iso (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
# Specify the same iso file for when firadisk runs in winpe
find --set-root /firadisk/loadiso.cmd
write (99) [FiraDisk]\nStartOptions=cdrom,vmem=find:/ISO/%ask%.iso;\n\0
chainloader (0xff)/BOOTMGR || chainloader (0xff)
clear

# Note: You must edit /firadisk/auWin8.xml with correct Product Key first!
title 4 INSTALL Windows 8 32-bit\nThis will install Windows 8 32-bit to your hard disk
debug off
set MYISO=Windows8-ReleasePreview-32bit-English.iso
find --set-root /Autounattend.xml
dd if=(bd)/firadisk/auWin8.xml of=()/AutoUnattend.xml
dd if=(bd)/firadisk/spaces.txt of=()/firadisk/ISONAME.CMD
root (bd)
write ()/firadisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\n
map --mem (md)0x800+4 (99)
map /ISO/%MYISO% (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
write (99) [FiraDisk]\nStartOptions=cdrom,vmem=find:/ISO/%MYISO%;\n\0
chainloader (0xff)/BOOTMGR || chainloader (0xff)

# NEW MENUS - NOT IN DOWNLOAD!
# Note: User must enter the Product Key first 
title 5 INSTALL Windows 8 32-bit\nThis will install Windows 8 32-bit to your hard disk
debug off
set MYISO=Windows8-32bit-English.iso
find --set-root /Autounattend.xml
dd if=(bd)/firadisk/auWin8.xml of=()/AutoUnattend.xml
set /p /u KEY=Enter Product Key (AAAAA-BBBBB-CCCCC-DDDDD-EEEEE-FFFFF) : 
cat --locate=TK8TP --replace=%KEY% /AutoUnattend.xml > nul
dd if=(bd)/firadisk/spaces.txt of=()/firadisk/ISONAME.CMD
root (bd)
write ()/firadisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\n
map --mem (md)0x800+4 (99)
map /ISO/%MYISO% (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
write (99) [FiraDisk]\nStartOptions=cdrom,vmem=find:/ISO/%MYISO%;\n\0
chainloader (0xff)/BOOTMGR || chainloader (0xff)


# Copy the next menu and change the product key and highlighted text to install any version with your own key

title 6 INSTALL Windows 8 32-bit Professional (Fixed Product Key)\nThis will install Windows 8 32-bit to your hard disk
debug off
set MYISO=Windows8-32bit-English.iso
find --set-root \Autounattend.xml
dd if=(bd)/firadisk/auWin8.xml of=()/AutoUnattend.xml
# ------------ change the next line to use your own product key  ----------
set KEY=AAAAA-BBBBB-CCCCC-DDDDD-EEEEE-FFFFF
cat --locate=TK8TP --replace=%KEY% /AutoUnattend.xml > nul
dd if=(bd)/firadisk/spaces.txt of=()/firadisk/ISONAME.CMD
root (bd)
write ()/firadisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\n
map --mem (md)0x800+4 (99)
map /ISO/%MYISO% (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
write (99) [FiraDisk]\nStartOptions=cdrom,vmem=find:/ISO/%MYISO%;\n\0
chainloader (0xff)/BOOTMGR || chainloader (0xff)



# ... more Win8 RP and 2012 menu entries are also included in the download and are here...

5. Now prepare a USB Flash drive using RMPrepUSB (if you already have a bootable USB drive with grub4dos installed you do not need to do this - but you do the newish version of grldr)

    Run RMPrepUSB (use v2.1.622 or later)
        To wipe and format the USB drive (optional) - set the following options in RMPrepUSB:
        1. MAX
        2. (any volume name you like!)
        3. WinPE v2/v3 (or DOS or FreeDOS or XP)
        4. FAT32 or NTFS (or FAT16 but it has a 2GB limit)  and also select the Boot as HDD option ('Boot as HDD' adds a small 2nd partition and makes the BIOS to boot it as a hard disk instead of a ZIP or Floppy drive and thus you don't get 'flashing cursor' on boot on some BIOSes - e.g. EeePCs!)
        5. Tick Copy OS Files box and set the Copy Folder to C:\WINFIRA
        6. Click Prepare Drive to format the drive and copy the files over

 
Fig. 43.5.1 RMPrepUSB settings to make a bootable USB drive (don't forget step 6 below!)

      NOTE: Whether you already have an existing grub4dos USB drive or have just formatted one as detailed above, you need to install the latest version of grub4dos as follows:
       


6. Now click on Install grub4dos and choose Yes for MBR and hit Enter to copy across the grldr file. You need the correct grub4dos grldr file as this supports some newer grub4dos commands.


Contents of bootable grub4dos drive should now be:

AutoUnattend.xml
grldr   (new 'chenall build' version as used by latest RMPrepUSB)
Menu.lst
\FiraDisk folder
au.xml
firadi64.cat
firadi64.sys
firadisk.cat
firadisk.inf
firadisk.sys
LOADISO.CMD
slp.exe
spaces.txt
wenv
\i386\devcon.exe
\ia64\devcon64.exe
\ISO folder
Choose_an_iso
(your iso files go here) <<<<<<<<<<<<<<<<<<<<<<<<<<<<< (use short names if possible to avoid typing!)



That's it!
To test your menu, run RMPrepUSB and hit F11 to run the QEMU emulator (you should create a small virtual hard disk so enter 100 when prompted - but if you want to try installing Windows to the virtual drive you will need a size of at least 10000). Note that you can only test the menu out using this method, once the ISO starts to runs it seems to crash under QEMU!


Fig. 43.6.1 grub4dos text menu displayed when you boot using QEMU or a real system.

                This is the unchanged menu.lst provided with the download. You can add more entries or delete the ones you do not want.

Now go boot it and install Windows on something!


The screenshot below shows the INSTALL WINDOWS - Boot from any Windows ISO menu option action.
The grub4dos menu will look for a marker file (the file '\ISO\Choose_an_iso') on every drive and list the files in that folder when it finds it, so that the user can choose one of them...

Fig. 43.6.2 The list of iso files in the folder is presented to the user so they can type the name of any one in.


Note: you must use the USB drive on a real system - WinPE needs to see a removable drive containing the AutoUnattend.xml file.

You may have problems using an emulator such as QEMU as the dd command needs a writeable drive in order to succeed - but most emulators do not allow writes to physical drives such as USB drives so test the USB drive on a real system not an emulated one as it will only work on a real system.

If your USB drive is NTFS, you must ensure that any file you write to is over 1K in size - grub4dos cannot use dd to write to small files on an NTFS system (the first 800 bytes or so are stored in the data section of the $MFT entry).

If a repair utility is present, you will be asked if you want to try to repair the current installation.


Fig. 43.6.4 IMPORTANT: you should see the blue Windows Command Shell window which installs the FiraDisk driver
 and then load the ISO file when Windows Setup starts
. If you don't see this then it won't work!


Fig. 43.6.5 First screen from Windows 7 install ISO

Fig. 43.6.6 The OS choice menu - this should list all the images present in the install.wim.

Once your OS has installed, if the system reboots back to the USB drive again, just use the 3rd menu item to boot from the hard disk (or just remove the USB drive and reboot).

Note: To add a standard XP install ISO to your USB drive, see Tutorial #30.

How to avoid needing a product key for Windows 8

If you don't want to have to edit the auWin8.xml file or have the user enter a product key each time, you can do this by modifying the ISO file. Using UltraIso, load the iso file and edit the \sources\ei.cfg file (depending on what version you have add one of the three versions) as follows:

FOR RETAIL:
[Channel]
_Default

[VL]
0

FOR OEM:
[Channel]
OEM

[VL]
0

FOR ENTERPRISE:
[Channel]
Volume

[VL]
1

Save the iso file again (and make sure you run WinContig on the ISO to ensure it is contiguous afterwards). You will now not be prompted for any Product Key but all images/SKUs should be dislayed, however you will still need to enter a valid product key and activate it before 30 days have elapsed.

This can be done on an All-In-One ISO so that you can select any of the images inside.


Addendum - How to use this technique using a bootable USB Hard drive

 
The auto-detection of \AutoUnattend.xml will not work if you use a hard drive (neither USB nor IDE/SATA) as a hard drive is not a 'removable' disk, we need to patch the ISO files themselves so that they will automatically run the LOADISO.CMD from the boot drive. To do this we need to copy the contents of the ISO file to an empty folder, modify the ISO file contents and then create a new version of the ISO file.
 
The guide below is for advanced users. I assume you already know how to mount images using ImageX (or DISM or GImageX) or can use similar tools. It is easiest to download and install the Windows 7 WAIK (over 1.3GB!). However, you can use Tutorial #83 to just download ImageX in about 30 seconds!

Please refer to my other tutorials (e.g. for WAIK and Virtual CloneDrive  see Tutorial #1) for details on installing and using the WAIK.

1. Using your Windows 'office' system, Mount the ISO that you want to modify using ImDisk or Virtual CloneDrive or any suitable tool and extract all the contents to an empty folder on your hard drive (e.g. C:\TESTISO)

2. If you want to be able to install any edition of Windows (e.g. all Vista/Win 7 SKUs rather than just Professional), then delete the C:\TESTISO\SOURCES\EI.CFG file.

If you have Win8, you will need to change the ei.cfg file contents to:

[Channel]
_Default

[VL]
0


3. Run a WAIK command prompt as Administrator (found in the Start Menu after installing WAIK) and mount the C:\TESTISO\Sources\boot.wim file (use Imagex /info to determine the correct image number that you need to mount, usually this is Index #2 - but not always!). e.g.

imagex /info C:\TESTISO\SOURCES\boot.wim
(check what images you have by looking at the output)
mkdir c:\mount
imagex /mountrw C:\TESTISO\SOURCES\boot.wim 2 c:\mount

IMPORTANT: Make sure you use the correct wim image number - it is not always 2!

4. Now we just need to copy the two files to the C:\mount\windows\system32 folder - winpeshl.ini and mysetup.cmd. Use the ones in the \FiraDisk folder inside the tutorial download. Their contents are shown below just for reference:

winpeshl.ini

[LaunchApps]
x:\windows\system32\mysetup.cmd


mysetup.cmd
@echo off

TITLE MYSETUP.CMD
REM run wpeinit after loading ISO file
:LDISO
cmd /q /c  "FOR %%i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %%i:\FIRADISK\LOADISO.CMD  cmd /k %%i:\FIRADISK\LOADISO.cmd"

TITLE MYSETUP.CMD
REM find RAMDRIVE with ISO contents
for %%I in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%I:\sources\install.wim set RAMdrive=%%I:
If "%RAMdrive%"=="" (
for %%I in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%I:\sources\install.wim set RAMdrive=%%I:
)
If "%RAMdrive%"=="" (
for %%I in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%I:\sources\install.wim set RAMdrive=%%I:
)
If "%RAMdrive%"=="" (
for %%I in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%I:\sources\install.wim set RAMdrive=%%I:
)
If NOT "%RAMdrive%"=="" echo Found Install.wim at %RAMdrive%\sources\install.wim
IF "%RAMdrive%"=="" (
echo ERROR - COULD NOT FIND INSTALL.WIM!
pause
pause
REM Retry
goto :LDISO
)

echo Run Setup.exe with Repair option from X: drive (if available)
if exist X:\Setup.exe X:\setup.exe

echo looking for setup in root of DVD ISO
If exist %RAMdrive%\setup.exe  (
%RAMdrive%
REM setup will use its path to find the install.wim
%RAMdrive%\setup.exe
goto :RBT
)

echo looking for setup.exe in \sources on DVD ISO
If exist %RAMdrive%\sources\setup.exe  (
%RAMdrive%
REM setup will use its path to find the install.wim
echo Launching %RAMdrive%\sources\setup.exe
%RAMdrive%\sources\setup.exe
goto :RBT
)

REM if not then just call setup in root of boot.wim and point it at install.wim
if exist X:\sources\Setup.exe X:\sources\setup.exe /installfrom:%RAMdrive%\sources\install.wim
if exist X:\Setup.exe X:\setup.exe /installfrom:%RAMdrive%\sources\install.wim
goto :RBT

:BAD
dir X:\ /b
echo Cannot find X:\Setup.exe !
@echo Press a key to reboot now...
pause

:RBT
wpeutil reboot
pause


Although these two files are located in the \FiraDisk folder inside the Tutorial #43 Tut43_FiraIso.zip download for your convenience, they are not actually used in booting and can be deleted from the\FiraDisk folder after copying them to the mounted ISO folder - if you wish.

4. Commit the changes and unmount the mounted image - e.g.

(close any Explorer windows which point at C:\mount first!)
imagex /unmount /commit c:\mount
imagex /cleanup

5. Create a new ISO file from the WAIK command prompt:

 to make a bootable ISO use the command:

oscdimg.exe -b"C:\Program Files\Windows AIK\Tools\PETools\x86\boot\etfsboot.com" -u1 -d -h -m -lWIN732SP1 C:\TESTISO\ C:\Win732SP1.iso
         
  - OR -  for a non-bootable ISO (but still usable for this tutorial and it will still load Windows Setup) use:

oscdimg.exe -u1 -d -h -m     -lWIN732SP1    C:\TESTISO\      C:\Win732SP1.iso

(-l specifies the volume Label - note that the source path C:\TESTISO\ ends in a back-slash - however some versions of oscdimg may not like the final \ and you may get a 'usage' message - if so then remove the last backslash). The -u1 (ISO9660) option ensures that the ISO is readable in both UDF and ISO 9660 (grub4dos readable) format - NOTE: when mounted by grubdos, all filenames will be uppercase - e.g. BOOTMGR not bootmgr. For maximum compatibility (e.g. with WinImage) you can also add -j1 for Joliet format (upper/lower case and long filenames).

6. Now follow the tutorial above but use this new ISO file. 

7. (optional) 
The Autounattend.xml file in the root of the USB drive is not required and can be deleted.
If you delete the AutoUnattend.xml file, you need also to change the menu.lst slightly and delete the lines that mention AutoUnattend.xml, otherwise the grub4dos menu will give an error as the file will no longer exist.

8. The new ISO should allow you to install any edition of Windows that is contained within the Install.wim file. You can also use the same files on a USB Flash drive if you wish.

Note: MySetup.cmd can run different versions of Setup.exe
X:\Setup.exe will run Setup and offer the Repair Operating System option.
%RAMDRIVE%\Setup.exe and \Sources\Setup.exe will go straight to the 'Install Windows' GUI and will not allow the user to Repair Windows.

If you do not want the Repair option offered, you should comment out the line shown in purple in MySetup.cmd (i.e. place a double colon :: in front of it - or delete the line).
To remove the Repair Y/N question, delete the following lines from the Firadisk\Loadiso.cmd file

if not exist X:\sources\recovery\startrep.exe goto :SKIP_REPAIR
echo.
echo ********* REPAIR WINDOWS? **************
echo.
set /P ASK="Do you want to try to repair Windows (Y/N)? : "
if /I "%ASK%"=="Y" start /w X:\sources\recovery\startrep.exe



TroubleShooting

See Tutorial 30 for XP troubleshooting.

Check you have a recent (2011) version of grub4dos - only later versions support grub4dos variables. If you already have a grub4dos boot drive and do not want to re-format it or install grub4dos using RMPrepUSB, then just copy over the grldr file from the RMPrepUSB folder to your USB boot drive to update it.

If any of the commands fail, try adding a pause command after each line to see which line gives the error:

title Install Windows 7 64-bit Enterprise Edition\nRun the Windows install DVD to install a copy of Windows to your hard disk
echo 1 && pause
find --set-root /Firadisk/loadiso.cmd
echo 2 && pause
etc,
set mm=map /ISO/%MYISO% (0xff)
%mm%
echo %mm%
pause


If the map command fails for 'file not contiguous' - you will need to run WinContig.exe (CTRL+F2 in RMPrepUSB) on the failing ISO file (on the USB drive) to defrag it. If this fails to work (usually because you do not have enough spare space on the USB drive), then you will need to copy ALL the files from the USB drive to your hard disk, reformat the USB drive using RMPrepUSB as in step 3. It is often faster and easier to re-copy the files than it is to use WinContig on a large USB iso file.

Some grub error numbers are reported here - these may or may not be the same as in grub4dos, but may be useful as a reference.

If Setup seems to want to install the wrong version of Windows (e.g. you are prompted to install Vista Business instead of say Windows 7 Home Premium) check that none of your drives have a file in the folder \SOURCES called INSTALL.WIM - this includes any Windows install DVD-ROM you may have left in your DVD-ROM drive!

Some members of reboot.pro have reported that their system does not detect the AutoUnattend.xml on their USB pen. In one case this turned out to be an unlucky combination of Buffalo USB pen, Server 2008 ISO (not R2) and a Dell Latitude E6400. Other USB pens worked and other OS ISO's worked. Another user reported difficulty with their SanDisk pen. If the blue command console window does not briefly pop-up and run during the boot from the ISO or the first part of the Windows Setup GUI, then press SHIFT+F10 to get a console window and type DISKPART followed by LIST DISK to see if your USB drive is listed (if no USB drive is listed then it means your USB drive is incompatible with the OS ISO your are trying to use) - if the USB drive is not listed, type RESCAN and then LIST DISK to see if it is now listed. If it is you may have an incompatible USB drive - try a different make or model. Use EXIT to quit Diskpart.

Alternatively, try the workaround for Fixed disks at the top of this page (i.e. also insert another different USB pen drive with the AutoUnattend.xml file on it).

If you are using an OEM Recovery Disk ISO file, the AutoUnattend.xml detection may be suppressed. In this case you will have to use the manual method detailed in the workaround for Fixed disks at the top of this page and run a command prompt (SHIFT+F10 may not work so use the OEM Command prompt menu entry instead) - or - unpack the ISO and make a new one without any unattend.xml file in it (the new ISO does not need to be bootable so any 'makeiso' tool will do to make the ISO). 

In rare cases if Windows cannot find the 'CD\DVD' and asks for a driver, try this: click Cancel (you will be return to the welcome screen) - now remove your USB drive and insert it into a different USB port so that Windows will re-detect the USB drive - click Install Now again - the installation process may now find the 'CD/DVD' and will continue as usual.

How it works (when using a USB Flash drive)

The boot/mapping sequence goes like this:

ISO mapped as virtual drive by grub4dos -> load WinPE (ISO drive is now lost as in protected mode) -> find and load AutoUnattend.xml -> find and run \FiraDisk\LoadIso.cmd -> run FiraDisk (or ImDisk) and load ISO as virtual drive under WinPE (iso filename is passed via ramdrive from grub4dos) -> Exit command shell -> Setup continues and finds \sources\Install.wim on virtual disk loaded by FiraDisk or ImDisk.

  1. The menu.lst basically just maps the ISO file as a DVD-ROM drive (0xff) but this mapping is lost as soon as Setup fully loads up into RAM and enters protected mode. However, we also write the name of the iso file to a ramdrive whilst in the grub4dos menu. We do this because we need to tell FiraDisk the name and path of the ISO file when Setup starts to run.
  2. When the ISO boots, it will prompt you to 'Press any key to boot from the CD or DVD' - because it thinks you are booting from a DVD (tip: press a key!).
  3. Now when a Windows Vista/7/2K8 WinPE based Setup runs, WinPE always tries to look for a file called AutoUnattend.xml or Unattend.xml which has a 'WindowsPE' section containing commands and configuration settings. The file AutoUnattend.xml must be on a Removable disk and not a Fixed disk. Luckily, we just happen to have such a file (\AutoUnattend.xml) on the USB Flash drive (cos we put it there!). This contains a command to run the file \FiraDisk\LOADISO.cmd from wherever it can find it (it searches all drives until it finds it)
  4. LOADISO.cmd runs FiraDisk and maps the ISO file as a virtual drive, ready for Windows Setup to scan and recognise. if this does not work then ImDisk is used to load the ISO file.
  5. We then exit from the LOADISO script to allow WinPE to continue and run Setup.
  6. Setup continues to run once LOADISO has finished executing and starts to look for a drive which has the \sources\install.wim file on it (this contains the Windows images).
  7. Now when Setup looks for the \sources\install.wim file, it finds it on the new virtual drive which was made by FiraDisk and thus continues as normal - just as if it booted from a real DVD.
The way that we pass the correct path for the ISO file is via these lines in menu.lst
map --mem (md)0x800+4 (99)                                                                                      creates a new ram drive
write (99) [FiraDisk]\nStartOptions=cdrom,vmem=find:/ISO/win7.iso;\n\0                    writes the name of the iso to the ramdrive - when the FiraDisk driver loads, it will try to find it

# here we also write a file so that ImDisk can get the name of the ISO we want to load (in case FiraDisk does not work)
dd if=()/firadisk/spaces.txt of=()/firadisk/ISONAME.CMD
write ()/firadisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\n

When LOADISO loads the FiraDisk driver using devcon.exe, FiraDisk looks for the special grub4dos parameter in memory and then searches all media until it finds the file specified and then loads it as a CD/DVD.
If firadisk fails to load the ISO file, then the latest version then tries to use ImDisk. The iso filename is passed to ImDisk by this line in the grub4dos menu:
write ()/firadisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\n
More information about FiraDisk can be found here.
More information about ImDisk can be found here.
RMPrepUSB Blog - please leave a comment or feedback on RMPrepUSB or this Tutorial (please mention Tutorial number).

Automated Installs

The xml file in the \firadisk folder will need to be changed. See here for details.

Large All-In-One ISO files, NTFS and multiple partitions

If you have an AIO ISO file which is over 4GB, you will need to use an NTFS partition because FAT32 cannot support files >4GB. 

If you want a FAT32 and an NTFS partition on your flash disk, then the NTFS partition containing the ISO files must be the first entry in the partition table on a Flash drive. This is because WinPE (as used by Windows Setup) will only mount the partition that is in the first table entry on the USB flash (removable) drive. This is why Windows will only show one volume in Windows Explorer when you insert a multi-partition USB Flash drive.

The recommended partition order is therefore:

1. NTFS
2. FAT32

However, if your partitions are in a different order, if you use the RMPrepUSB  -  Ctrl-O function, you can re-order the two partitions in the partition table. Windows will only see the first entry in the partition table (regardless of the position of the actual partition areas on the disk).

The menu.lst and \firadisk folder and \AutoUnattend.xml files should all be on the NTFS partition.