032 – CREATE A USB DRIVE WITH MULTIPLE VISTA/WIN7/SERVER2008 INSTALL ISO FILES IN 3 SIMPLE STEPS!

New (26 April 2011): Windows Repair feature now included (please use new Winiso_ImDisk_32a.zip file in Beta Downloads section)!

New (23 June 2011): Universal menu added which lets the user pick any iso file. Can now have the ISO folder on any hard drive instead of the boot drive.

See also new Tutorial #43 which is similar but neater and uses FiraDisk and does not rely on writeable boot media to pass the ISO filename. Also includes a method of using any Windows installation ISO from a hard disk (see Addendum).

Windows 10 is not supported (requires a recent version of ImDisk).

NOTE: This tutorial has now been superceded by Tutorial #43 – please use Tutorial #43 which uses FiraDisk.

INTRODUCTION

I assume you have a number of MS Vista\Win7\SVR2K8 or later install ISOs (or DVDs from which you can make ISOs) and you want to put them all on one single USB Flash drive (or you can use a USB hard drive – but see *Note below) so that you can install any OS onto the target system’s hard disk by booting from the USB drive.

Well, it’s as easy as 1-2-3!

Watch the YouTube video here >>>>>

Note: this video shows MS-DOS FAT32 being used.

Any choice will work as grub4dos will not use the OS boot code.

You can download some Windows 7 ISOs from here.

Workaround if using a USB Hard Disk as the boot device

*Note: Read this section only if you are going to use a USB hard disk drive instead of a USB Flash drive …

USB hard drives usually appear in Windows Explorer as ‘Fixed Disks’ and not as Removable Disks, The method described below only works if a Removable disk contains the AutoUnattend.xml file. However the method below can still be made to work but you will have to type a few commands each time (or have a spare USB Flash drive handy) because the AutoUnattend.xml file is not recognised by Windows PE if it is on a fixed disk and this procedure only works if the autounattend.xml is detected on a removable drive!

Method 1: If the Windows Setup cannot find a source ‘DVD’ and asks you to install a driver, you will need to:

  • Once Setup has loaded – type SHIFT+F10 (hold down the SHIFT key and press and release the F10 key) – a command prompt console window should open
  • Find which drive letter the USB hard disk is on by typing ‘dir C:‘ {Enter} then dir d: {Enter} etc. until the USB hard drive is listed – let us assume it is C: for now
  • Type C: {Enter} where C is the letter of your USB hard disk
  • Type IMDISK\LOADISO.CMD – a blue command prompt window should open and then the blue and black windows should close.

Now try running Setup again from the beginning (DO NOT REBOOT, just use Back/Cancel buttons to go back to the first screen) – this time it should find the Windows DVD as IMDISK will have loaded it as a Virtual DVD.

Method 2: An easier alternative is to use a small USB Flash Drive in addition to your USB bootable hard disk. You will just need to copy the Autounattend.xml file to the flash drive (it can also have any other files you like on it, as long as it has the AutoUnattend.xml in the top level/root). The USB hard disk drive containing all your ISO files should be made as detailed in the instructions below. Then boot from USB HDD with the USB flash drive also present in the system (or, just as the WinPE horizontal loading bar appears, insert the USB Flash drive before WinPE is fully loaded). WinPE should then see AutoUnattend.xml on your removable USB flash drive and load ImDisk from your USB hard disk and map the ISO file that you wanted. In the case of Windows 7 SP1 Enterprise Edition, the AutoUnattend.xml is loaded and ImDisk is run after you have selected your locale (country, etc.) and then clicked on ‘Install now’. Each time the large ‘Setup is Starting’ text appears the AutoUnattend.xml is found on the flash drive and is automatically executed.

One method for quick experimental OS installation is to have a test PC which has two or more partitions on the one hard drive (or more than one hard drive). You can have the \ISO folder containing all your ISO files on one partition of the hard drive. Create a USB flash drive as below and boot from it. You can then install any SKU of Windows to the 2nd hard disk partition by booting from the USB flash drive, the ISOs on the hard disk first partition will be automatically found and used. This is a very fast way to re-install any Windows OS.

Method

Note: see also the new ‘Universal‘ method at the bottom of this page – no menu needs to be edited at all – you just drop your ISO files into the \ISO folder!. The menu lists all the ISO files and the user selects which one they want.

1. Download the file WINISO_IMDISK_32a.ZIP (new as of 2011-6-23 !!!) from the Beta Downloads – Tutorials section and extract the contents to a folder on your office system hard disk – say C:\WINDOWS_ISOS.

WINISO_IMDISK.ZIP contains:

\AutoUnattend.xml (must be in root of a REMOVABLE drive – i.e. a drive that appears as ‘Devices with Removable Storage’ and not under ‘Hard Disk Drive’ disk under Windows 7 Explorer)

\menu.lst (also must be in root of USB drive)

\ImDisk folder (folder located in root of USB drive)

2. Now copy over your ISO files to the ISO subfolder C:\WINDOWS_ISOS\ISO which you will need to create and then edit the menu.lst file afterwards so that the location of all your ISO files matches the menu entries.

Note that you will need to alter the highlighted portions below to match your ISO files (this example assumes you store your ISO files in the \ISO folder on the USB drive):

PLEASE NOTE: The line beginning with ‘write’ should not contain any device name, it only should contain a path, the code in LOADISO.cmd will determine which drive the ISO is on by searching all drive letters for it – even if the ISO is on another hard drive or DVD drive it will find the ISO file, so the ISO file does not even have to be on the same USB drive!

  • title Install Windows 7 64-bit Enterprise Edition\nRun the Windows install DVD to install a copy of Windows to your hard disk
  • find –set-root /ImDisk/myiso.cmd
  • dd if=()/ImDisk/au.xml of=()/AutoUnattend.xml
  • dd if=()/ImDisk/cr.txt of=()/ImDisk/myiso.cmd
  • write ()/ImDIsk/myiso.cmd SET MYISO=\\iso\\en_windows_7_enterprise_with_sp1_x64_dvd_620201.iso\r\n
  • map /iso/en_windows_7_enterprise_with_sp1_x64_dvd_620201.iso (0xff)
  • map (hd0) (hd1)
  • map (hd1) (hd0)
  • map –hook
  • chainloader (0xff)
  • title Repair Windows 7 64-bit Enterprise Edition\nRepair Windows on your hard disk
  • find –set-root /ImDisk/myiso.cmd
  • dd if=()/ImDisk/spaces.txt of=()/AutoUnattend.xml
  • map /iso/en_windows_7_enterprise_with_sp1_x64_dvd_620201.iso (0xff)
  • map (hd0) (hd1)
  • map (hd1) (hd0)
  • map –hook
  • chainloader (0xff)
  • #Add more menu items here for more ISO files by repeating the two menus above.
  • title 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)

N.B. The path in a grub4dos menu uses a forward slash / and not the Windows backslash \ character but for the SET MYISO line we need to use \\ to specify a windows path.

3. Prepare the USB drive using RMPrepUSB (if you don’t already have one – if you do then you need to have the grub4dos bootloader installed – RMPrepUSB can just add the grub4dos bootloader for you):

Run RMPrepUSB – if you have a USB Flash dirve, make sure it is listed as a Removable Drive and not a Fixed Disk.

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

5. Tick Copy OS Files box and set the Copy Folder to C:\WINDOWS_ISOS (note: we want to COPY the files in the folder NOT extract from a file)

6. Click Prepare Drive to format the drive and copy the files over

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:

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

Note: Vikram has found that this method does not work if you are using plopto boot from the USB drive. This is because plop does not support writes to disk and so the write to \ImDisk\myiso.cmd will not work.

That’s it. Now go boot it and install Windows on something – you should see the blue Windows Command Shell window flash up briefly.

Note: you must use the USB drive on a real system – an emulated\virtual one may not work – e.g. QEMU won’t work as writes are disabled by default in QEMU on PhysicalDrives so the ‘write’ command will not actually work! Also WinPE needs to see a removable drive containing the AutoUnattend.xml file so an emulator usually won’t work.

Once your OS has installed, if the system reboots back to the USB drive again, just use the last 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.

TroubleShooting

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 /ImDisk/myiso.cmd
  • echo 2 && pause
  • dd if=()/ImDisk/au.xml of=()/AutoUnattend.xml
  • echo 3 && pause

etc,

If the map command fails for ‘file not contiguous‘ – you will need to run WinContig.exe (RMPrepUSB CTRL+F2) 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 you are prompted during Setup with a strange menu such as the one below:

A = Win 7 SP1 32-bit Enterprise

B = Win 7 SP1 32-bit Professional

C = Win 7 SP1 64-bit Enterprise

Then this is because your menu.lst entries were not correct. Have a look at the file MYISO.CMD using Notepad – it should contain the ISO file path and name of the last entry that you chose. If not then you have made a mistake in the menu.lst text – check your menu.lst carefully for missing or extra spaces or characters. If it seems OK, re-copy cr.txt and myiso.cmd to your USB drive again and overwrite the old ones.

P.S. The A/B/C menu comes from code in the file LOADISO.cmd. LOADISO.cmd runs MYISO.cmd – if MYISO.cmd does not have a SET MYISO=xxx command inside it, the LOADISO.cmd will display a pre-set menu instead. The ISO files in this menu won’t actually exist (as I made them up!), but you can always edit the LOADISO.cmd file to point at your own ISOs if you really cannot get this to work!

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 *Note 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 *Note workaround for Fixed disks at the top of this page and get to 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).

How it works

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 \ImDisk\LoadIso.cmd -> call MYISO.CMD -> run ImDisk and load ISO as virtual drive under WinPE -> Exit command shell -> Setup continues and finds \sources\Install.wim on virtual disk loaded by 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 a file (\ImDisk\MYISO.CMD) which contains the text SET MYISO=xxxxx (where xxxx is the path and filename of the ISO that you want to install) to the USB drive. We do this because we need to tell ImDIsk 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 \ImDisk\LOADISO.cmd from wherever it can find it (it searches all drives until it finds it).
  4. LOADISO.cmd has the job of mapping the ISO file as a virtual drive before Setup can continue.
  5. When the file \ImDisk\LOADISO.cmd is run (as AutoUnattend.xml tells Setup to run it) it calls \ImDisk\MYISO.cmd which runs the SET command to set the variable MYISO to the path of the ISO which needs to be loaded. Now that we know the full path we can search for the ISO on all drives until we find out which drive letter the ISO file is on.
  6. LOADISO.cmd then runs ImDisk and maps the ISO file as a virtual drive, ready for Windows Setup to scan and recognise.
  7. We then exit from the LOADISO script to allow WinPE to continue and run Setup.
  8. 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).
  9. Now when Setup looks for the \sources\install.wim file, it finds it on the new virtual drive which was made by ImDisk 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

dd if=()/ImDisk/cr.txt of=()/ImDisk/myiso.cmd

write ()/ImDIsk/myiso.cmd SET MYISO=\\iso\\en_windows_7_enterprise_with_sp1_x64_dvd_620201.iso\r\n

The first line erases the previous contents of myiso.cmd so that it contains all new lines (CR+LF characters) by copying the contents of the cr.txt file to the myiso.cmd file.

The second line writes the string ‘SET MYISO=xxxxxxxxxxxxx’ into the myiso.cmd file, followed by a carriage return (CR) and Line Feed (LF) character to end the line.

Note that the myiso.cmd file is over 2K long because the grub4dos dd command does not like files shorter than 2K if they are on an NTFS filesystem. The myiso.cmd file must be the same length or longer than cr.txt or you will get file corruption on your USB drive (the files are the same length in the download – so just don’t edit them!).

Some ISOs do not allow the user to choose the repair option but instead show all Editions of Windows that are present in the install.wim file. This is great unless you actually want the Repair option!

To force the repair option to appear, we need to remove the text from within the AutoUnattend.xml file. This is what the dd of=()\Autounattend.xml line does in the 2nd menu. It overwrites the \AutoUnattend.xml file with either a lot of spaces or the correct contents. Again, the files must be over 2K as the NTFS filesystem (if used on your flash drive) under grub4dos gives an error if the file length is under 2K and you try to use dd.

Forcing the Repair option to be given is done using this line to get rid of the xml content by filling the file with spaces…

dd if=()/ImDisk/spaces.xml of=()/AutoUnattend.xml

or we can load the ISO as a DVD for an install by putting the correct commands into the Autounattend.xml file using…

dd if=()/ImDisk/au.txt of=()/AutoUnattend.xml

HOW TO MAKE A UNIVERSAL WINDOWS ISO USB FLASH DRIVE

The instructions below uses a similar method as in the tutorial above, but it prompts you to enter in the name of the ISO file that you want to load.

Once you set up your flash drive, just drop all your Windows Vista or later Windows install ISO files onto the Flash drive or any hard drive (in the \ISO folder) and you will be able to run any of them without needing to alter any menus at all! This will NOT work with XP ISOs!

Instructions

1. Download and extract the files from WINISO_IMDISK_32a.ZIP to a folder on your hard drive (same as step 1 above)

2. Remove the first two menus in menu.lst as those are for the method above and not required here (optional)

3. Prepare a grub4dos bootable USB Flash pen using RMPrepUSB (FAT32 or NTFS) and add the grub4dos boot loader (same as step 3 & 4 above) – you MUST use the latest version of grub4dos (approx April 2011 or later as used by RMPrepUSB v2.1.622 or later)!

4. Either on the flash drive OR on any hard disk that will be present on the TARGET system when the USB flash drive boots, create a folder named \ISO.

5. In the \ISO folder that will contain all your ISO files, create a new file called marker.txt – it can be empty if you like but it must be there!

6. Add any Windows install ISO files you like to the same \ISO folder that contains the marker.txt file

Note: to avoid the market.txt being listed together with your ISO files when grub4dos lists the ISO files on the screen, you can skip step 5 and use any one of your ISO files as a marker file. Just change the 3rd line find –set-root /ISO/marker.txt in the menus below to the name of an iso file that will always be present in your ISO folder – e.g. find –set-root /ISO/Win7SP132.iso.

If you want to store your ISO files somewhere else other than in the \ISO folder, you will need to change all references to /ISO/ in the menu.lst to whatever path you want to use.

Menu.lst

This menu is within the menu.lst contained in the download – it is show here for reference (you can cut and paste it in if you wish).

  • title INSTALL WINDOWS – 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
  • find –set-root /ISO/marker.txt
  • 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)
  • (bd)/ImDisk/WENV set ask=$U,$input,Enter iso filename WITH NO EXTENSION (e.g. Win7Pro32 ) :
  • (bd)/ImDisk/WENV get ask || echo No iso file specified! && configfile /menu.lst
  • clear
  • # check if user entered a valid filename with no ISO extension!
  • (bd)/Imdisk/wenv call ls /ISO/${ask}.iso || (bd)/ImDisk/WENV echo Cannot find /ISO/${ask}.iso !!! && pause –wait=3 && configfile (bd)/menu.lst
  • (bd)/ImDisk/WENV echo Loading /ISO/${ask}.iso – please wait …
  • #set root drive to USB stick
  • find –set-root /ImDisk/myiso.cmd
  • dd if=()/ImDisk/au.xml of=()/AutoUnattend.xml
  • dd if=()/ImDisk/cr.txt of=()/ImDisk/myiso.cmd
  • (bd)/ImDisk/wenv call write ()/ImDIsk/myiso.cmd SET MYISO=\\ISO\\${ask}.iso\r\n
  • (bd)/ImDisk/wenv call find –set-root /ISO/${ask}.iso
  • # run the grub4dos map command and specify the iso file we want to load
  • (bd)/ImDisk/wenv call map /ISO/${ask}.iso (0xff)
  • map (hd0) (hd1)
  • map (hd1) (hd0)
  • map –hook
  • chainloader (0xff)
  • clear
  • title REPAIR WINDOWS – Boot from any Windows ISO to repair Windows\nThis menu allows you to type in the name of any Windows ISO file and boot from it for a repair operation only
  • # find the ISO folder by looking for a marker file
  • find –set-root /ISO/marker.txt
  • 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)
  • (bd)/ImDisk/WENV set ask=$U,$input,Enter iso filename WITH NO EXTENSION (e.g. win7pro32 ) :
  • (bd)/ImDisk/WENV get ask || echo No iso file specified! && configfile /menu.lst
  • clear
  • # check if user entered a valid filename with no ISO extension!
  • (bd)/Imdisk/wenv call ls /ISO/${ask}.iso || (bd)/ImDisk/WENV echo Cannot find /ISO/${ask}.iso !!! && pause –wait=3 && configfile (bd)/menu.lst
  • (bd)/ImDisk/WENV echo Loading /ISO/${ask}.iso – please wait …
  • #set root drive to USB stick
  • find –set-root /ImDisk/myiso.cmd
  • dd if=()/ImDisk/spaces.txt of=()/AutoUnattend.xml
  • (bd)/ImDisk/wenv call find –set-root /ISO/${ask}.iso
  • # run the grub4dos map command and specify the iso file we want to load
  • (bd)/ImDisk/wenv call map /ISO/${ask}.iso (0xff)
  • map (hd0) (hd1)
  • map (hd1) (hd0)
  • map –hook
  • chainloader (0xff)
  • clear
  • title Boot from 1st Hard Disk \nBoot from MBR of first hard disk and then remove the USB drive
  • map (hd0) (hd1)
  • map (hd1) (hd0)
  • map –hook
  • chainloader (hd0)+1
  • rootnoverify (hd0)

The variable ${ask} holds the name of the iso file. Once defined, the variable’s value can be obtained by using wenv to call a grub4dos command and it uses ${ask} to insert the correct iso path string.

Note that you can also store the ISO files on a different drive (e.g. hard drive) using this menu. This means that you could have a USB flash drive containing just the grldr file, menu.lst, AutoUnattend.xml and the ImDisk folder (or a bootable hard drive partition), and a different hard drive or partition which could contain all your ISO files. This would allow you to install any OS you wanted to a separate different partition on your hard drive quickly and easily.

For more details on wenv, see Part 5 of the grub4dos tutorial.

For a similar but simpler method using FiraDisk, see tutorial 43.

Easy2Boot (E2B) is popular multiboot USB solution that also contains agFM and Ventoy. It supports both Legacy and UEFI.
Simply copy on your bootable ISO files to the E2B USB drive and boot! Boot to DOS, Linux, Windows Install ISOs (XP>Win11),
automate Windows installs, WIM files, VHD files, images of flash drives, Linux ISO+persistence, etc.
E2B is unique in that it uses partition images which allows you to directly boot from Secure Boot images (no need to disable Secure Boot or run MOK manager or modify your UEFI BIOS).

eBooks

The following eBooks (in PDF format) are available from the developer (rated 4.5/5 stars).

Also visit Easy2Boot.xyz and the my blog – please subscribe for the latest news, tips, USB boot articles and news of free eBook updates.