This tutorial will show you how to have a bootable USB drive (flash drive or HDD) which can contain any number of Vista, Win 7, Server 2008 or later Installation DVDs (both 32-bit and 64-bit) and boot from any one of them. You can then install that OS onto your PCs hard drive just as if you had booted from the DVD. This method does not load the ISO file into RAM and is just as fast as running from a flat-file USB drive and faster than booting from an install DVD.
For a quick and dirty method of adding Windows Vista/7 ISOs to your existing grub4dos USB drive (and if you don't mind having to type a few command line commands each time) see the ADDENDUM at the end of this tutorial.
Note: Tutorial #32 is an enhancement of this method but is fully automatic and very easy to set up.
The basic idea behind this is simple. You boot to WinPE, you use ImDisk to mount an ISO as a Volume letter, you run Setup.exe from the new volume letter. The only complication is that you cannot run a 64-bit Setup.exe from a 32-bit WinPE environment, so we need two WinPE versions on the same USB drive. To test this I used an 8GB USB Flash drive and Windows 7 SP1 64-bit Enterprise edition ISO and a 32-bit Vista Spanish edition.
If you also want to add OS installs from XP ISO files to your USB drive - see Tutorial #30.
This tutorial allows you to have a grub4dos boot menu that contains 2 entries
run on them to prevent bootmgr complaining that it has been corrupted when it is patched by the grub4dos write command. If you still get a 'corrupted' message it indicates that the first 'write' patch in the menu.lst entry is not the correct patch for your bootmgr file - check the CRC32 signature!
You will require source Microsoft ISOs for Vista/Win7/Server 2008 (note OEM DVDs should work also - some MS Win7 ISOs can be downloaded from here - use the Digital River links, some other links on this page may be broken). You can make an ISO file from a DVD if you use WinImage or similar software.
1. Prepare an empty folder on your main Windows computer hard disk (e.g. C:\WINISO)
2. Download and install the Windows 7 (RTM) WAIK - Note: it must be the RTM first release version and NOT Vista or Win7 SP1 version - check the CRC32 value of bootmgr if in doubt!
3. Run the WAIK command prompt (from Start Menu - Deployment Tools Command Prompt) and type the command: COPYPE x86 C:\x86 to make an 32-bit version of WinPE v3
4. Type the command: COPYPE amd64 c:\amd64 to make a 64-bit version of WinPE v3
5. Download the WINISO.ZIP file from the Beta Downloads - Tutorials section of this website and extract the contents to C:\WINISO
6. Copy the WinPE.wim file from C:\x86\winpe.wim to C:\WINISO\Sources\Boot1.wim and rename it
7. Copy the WinPE.wim file from C:\amd64\winpe.wim to C:\WINISO\Sources\Boot2.wim and rename it
8. Copy the bootmgr file from C:\x86\ISO\bootmgr to C:\WINISO\bootmgr (should be 14 July 2009 383,562 bytes in size if correct version of WAIK is installed - please check!) - see here for patches for different versions of bootmgr.
9. Copy the whole folder from C:\x86\ISO\boot to C:\WINISO\boot
10. Now we need to add some commands to the boot1.wim file and the boot2.wim file so that they will automatically find and run the RunISOxx.cmd file when WinPE boots.
Option: If you want to leave this bit until after you have tested your USB drive, you can skip the next two steps (skip step 10 and 11) - it just means you will have to find and run IMDISK\RUNISO32 or IMDISK\RUNISO64 manually when WinPE boots.
11. Now repeat this step again using boot2.wim but this time add the following text to the end of startnet.cmd (the only difference is in line 3)
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:%TARGET% set USBDRIVE=%%I:
If NOT "%USBDrive%"=="" echo Found %USBDRIVE%%TARGET%
IF "%USBdrive%"=="" (
echo ERROR - COULD NOT FIND %TARGET% on USB drive!
You should now have this folder structure (files included in the WINISO.ZIP download I supply are highlighted):
12. Now add all your OS DVD ISO files. For instance, make a folder called C:\WINISO\ISO and place your .iso files in there.
Note that Windows XP is not yet implemented (but it should work in theory - you would need to mount the ISO file in the same way, but you will need to run i386\Winnt32.exe and not setup.exe, so you will need to make a new MountDriveXP.cmd which runs i386\Winnt32.exe and also pre-format the hard drive first using Diskpart and using the CRE PAR PRI ALIGN 16065 command and then running bootsect /nt52 D: or it will not reboot for the 2nd GUI setup stage - a command line like:
D:\i386\winnt32 /syspart:D: /tempdrive:D: /makelocalsource /unattend:g:\unattend_XP_ABC.txt would automate the install and you could use entries in your added unattend.txt to install to a different partition if you wish). If you don't want fully automated installs, I would recommend you follow Tutorial #30 and simply add that to your menu.lst file.
13. Now you need to edit the C:\WINISO\ImDisk\RunISO32.cmd and C:\WINISO\ImDisk\RunISO64.cmd files to include the name of each of your ISO files and a menu entry for each of them:
TITLE WINDOWS 32-BIT OS INSTALL
echo A = Win 7 SP1 32-bit Enterprise
echo B = Win 7 SP1 32-bit Starter\Home Premium\Professional\Ultimate
REM add more here
SET /P ANS="Which ISO do you want? : "
IF /I "%ANS%"=="A" SET MYISO=\ISO\en_windows_7_enterprise_with_sp1_x32_dvd_620201.iso
IF /I "%ANS%"=="B" SET MYISO=\ISO\Win7SP1.iso
call \imdisk\MountDrive.cmd %MYISO%
You should change the "echo A" and "echo B" lines and add more entries if you wish.
Then change the "If /I %ANS%.." lines so the correct ISO file is selected and add more to match the menu text.
Do this for both RunISOxx.cmd files so you have both 32-bit and 64-bit ISO menus.
14. Now you need to prepare a bootable USB drive. Simply use RMPrepUSBand select NTFS or FAT32 and Boot as HDD - option 5 should be set to the C:\WINISO folder. Once you have hit the Prepare Drive button and all the files have been copied across (may take a while!), run Install Grub4dos and choose the PBR option and allow it to copy over the grldr file.
If you have RMPrepUSB v2.1.618 or later, just press the F11 (QEMU) function key and make a 5GB raw hard disk drive when prompted and test it out in a virtual environment (USB drive will be read-only),
Now go try it for real on a real system!
You can add more ISOs at any time to the ISO folder. Note that if you want to be able to install ALL SKUs of Windows, you may need to delete the \sources\ei.cfg file from within each ISO image so all the images are listed. Any ammended ISO does not need to be bootable though, so you can extract the ISO and then save it as a non-bootable ISO.
If ImDisk does not load an ISO image, it is probably because the ISO file is not contiguous. Run WinContig on the file on the USB drive - or - re-run RMPrepUSB and copy all the ISO files over again in one go after a fresh format (often faster).
ADDENDUM - How to quickly add Windows Vista/7/SVR2K8 ISOs to your existing USB bootable drive
This is a quick and dirty method which does not provide any menu once you have started setup, so it requires some user know how! It has the advantage that it is VERY easy to add to a boot USB drive and each ISO has its own grub4dos entry.
1. Download the WINISO.ZIP and extract the contents to your USB drive. Do not overwrite your own menu.lst file! The menu.lst, boot\bc1 and boot\bc2 files in the ZIP download can be discarded\deleted.
2. Add your ISO files
3. Add some grub4dos menu.lst entries, one for each Windows install DVD ISO, like this:
title Install Windows Vista 32-bit Spanish \nWhen Setup loads - type SHIFT+F10, find this USB drive and type \imdisk\MountDrive.cmd \iso\Vista32Spanish.iso
find --set-root /iso/Vista32Spanish.iso
map /iso/Vista32Spanish.iso (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
title Install Windows 7 64-bit \nWhen Setup loads - type SHIFT+F10, find this USB drive and type \imdisk\MountDrive.cmd \iso\Win764.iso
find --set-root /iso/Win764.iso
map /iso/Win764.iso (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
Now, to use these entries, this is what you need to do
1. Boot from the USB stick/drive and choose the new menu item - if the command fails, you probably need to run WinContig (RMPrepUSB CTRL+F2) on the ISO file to make it contiguous.
2. The Setup should start. Press SHIFT+F10 - a command prompt window should open. If it does not, just proceed to the next screen and try again. Keep doing this until you get a command prompt Window (some versions allow you to do this on the first screen, some do not!)
3. When you have a command prompt, find the drive letter of the USB drive. You can either do this by typing dir C: then dir D: then dir E: etc. - or you can type NOTEPAD and then use File - Open and use the notepad explorer pop-up to browser the drive letters until you can find which drive the USB boot drive is mapped to.
4. Now assuming the USB drive letter is D:, type:
where the second parameter is the path to your iso file. If a second instance of Setup starts, cancel it (you can prevent this by editing the \imdisk\mountdrive.cmd file and deleting the last line). Note: to saving having to type in the iso filename, you can just type \imdisk\mountdrive \iso\ and then hit the TAB key repeatedly to cycle through all the ISOs until you find the correct one, then press ENTER.
5. Now continue with the Windows Setup GUI. If Setup complains that it cannot find the source DVD and asks for a driver, just use Cancel which should take you back to the beginning of the Install and then try again and this time it should see the source DVD as you have now loaded it in step 4.
6. When Setup finishes, you need to remove the USB drive so that the system boots from the hard disk.