82 - Install XP to hard disk from ISOs using WinPE v3


site stats

Note: You can also make an Easy2Boot MultiBoot USB drive and just copy all your Windows ISO files to it and install Windows. Easy2Boot has an Install using WinPE option for XP ISo installs.

Introduction

Tutorial #3 described a way in which you could install XP from a USB drive by booting from a USB drive to WinPE (version 2 or 3) and copying the i386 files from the USB drive to the hard disk.
This Tutorial describes how you can have many different XP ISO files on one USB drive. This is a ONE-STEP process - only a single boot is required from the USB drive. You can automate an install by booting from the USB drive and just walk away and leave it to finish installing XP (if you remove all user prompts). This Tutorial also allows you to add driver files and applications to the target hard disk. If you have INF-based driver files, these will be automatically installed.

You can use each XP ISO file in many different ways, for instance using the same XP ISO file, you can:
  1. Launch the XP Setup GUI so that the user can manually create the hard disk partitions and enter the Product key, etc,
  2. Automatically format a partition but allow the user to run XP Setup manually
  3. Automatically format a partition and install XP to that partition (unattended)
  4. Automatically wipe and re-partition a hard disk and install XP to one of the partitions (unattended)
You can also easily modify the process without needing to edit the XP ISO files.
By adding another variable for a copy folder such as set CF=Dell530 and adding the drivers and applications for the Dell 530 to a Dell530 folder on the USB drive, the process will copy over those files too.

This means that you could have one ISO on a USB hard disk, but multiple menu items such as:
  • Install XP to Dell 530
  • Install Xp to EeePC 904HA
  • Install to Acer 7504
  • etc.
and have the drivers for each model on the USB drive under \ImDisk\COPYFOLDER\Dell530, \ImDisk\COPYFOLDER\904HA, etc. (avoid spaces in the folder names or it may cause problems!).

To ensure that the drivers are installed when XP boots, the unattend.txt answer file should contain an 
           OEMPnPDriversPath = "Drv\Net;Drv\Audio;Drv\monitor;Drv\Storage;Drv\Video;Drv\Mbd;Drv\Modem;Drv\Misc"
line or similar.

The folder structure on the USB boot disk for the Dell530 would then look like this:

\ImDisk\COPYFOLDER\Dell530\$OEM$\$1\Drv\Net
\ImDisk\COPYFOLDER\Dell530\$OEM$\$1\Drv\Monitor
\ImDisk\COPYFOLDER\Dell530\$OEM$\$1\Drv\Video
etc.

each folder should contain the INF files and driver files. $1 is the root of the hard disk, so this will make folders at C:\Drv\Net, C:\Drv\Monitor, etc. The INF files must be present in the exact folders named in the answer file (and not in subdirectories or differently named folders under DRV!). You can add more folders to the unattend.txt line, but beware, there is a 255 character limit to the answer file line length, so keep the folder paths short - or use drv\1;drv\2;drv\3 etc. if you want a lot of driver folders to be searched automatically by XP!

If you need to run a script when XP boots (for instance to silently install drivers or add software), you can add this entry to your answer file and it will run as soon as XP reaches the Desktop when the install completes - e.g.

[GuiRunOnce]
"c:\shortcut.bat"

This will cause the file c:\shortcut.bat to run (which you must provide), and you can then run any other batch files, install setup.exe drivers silently, install software, etc.
If you use shortcut.bat to add another batch file into the C:\Documents and Settings\All Users\Start Menu\Programs\Startup folder, you can ensure that any reboot will re-run that batch file again so you can continue the automated install.
Note: You cannot simply create an \ImDisk\COPYFOLDER\Dell530\$OEM$\$1\Documents and Settings\All Users folder because Windows will create an All Users.Windows folder instead of an All Users folder when it installs!

Summary

This how you would use the USB drive to install XP to an internal hard drive:
  1. Boot from a USB drive on the target system to a grub4dos menu
  2. Choose the desired grub4dos menu entry
  3. The system boots from the USB to WinPE v3 (x86 win7 version)
  4. The target hard disk is automatically partitioned (optional) and/or formatted
  5. The chosen ISO file is automatically mounted using ImDisk and the i386 folder is copied to the hard disk
  6. Winnt32.exe is launched automatically which copies the files to a temporary folder on the hard disk (this is quite quick)
  7. The system reboots from the hard disk (the USB drive can be removed at this point) and the XP installation continues with the text mode setup and then the GUI mode setup. Any INF-based drivers placed in the C:\DRV\xxx folders will be automatically installed.
For each ISO you can specify a different diskpart partition script and an unattend.txt/winnt.sif answer file.
You can omit one or both of these for a semi-automated or entirely manual install of XP.

Method

1. Prepare a WinPE v3 bootable OS by installing the MS WAIK as follows:

Using your 'office' Windows XP/Windows Vista®/Windows 7 PC (don't use the target system that you wish to install XP to):
1.1 Download the Windows 7 WAIK ISO file (e.g. KB3AIK_EN.iso 1.7GB).
1.2 Download and install your ISO mount utility. (e.g. VirtualCloneDrive or ImDisk) and use it to mount the WAIK ISO file
1.3 The WAIK Welcome window should launch. If not, double-click StartCD.exe on the new drive letter in Explorer. 
1.4 You must agree to the Terms and Conditions and you should have the correct licenses.
1.5 Install the .Net Framework Setup from the WAIK menu.
1.6 Install the MSXML 6 SP1 Setup from the WAIK menu.
1.7 Install the Windows AIK Setup from the WAIK menu.
1.8 Exit from the WAIK menu. The WAIK is now fully installed. You can optionally install the WAIK v3.1 update files too.

Follow the next steps carefully to prepare a set of bootable WinPE OS files...

1.9 Click on Start Menu, All Programs, Microsoft Windows AIK, Deployment Tools Command Prompt to open up an Administrator command prompt window.
1.10 Type   copy      ..\x86\imagex.exe c:\      and press Enter.
1.11 Type   copyPE  x86 c:\pe86                      and press Enter.
1.12 Type   copy      c:\pe86\winpe.wim c:\pe86\ISO\sources\boot.wim    and press Enter.

2. Modify the WinPE boot.wim using DISM to mount the boot.wim

2.1   On the 'office' system, launch the WAIK command shell (right-click - run as administrator)  window using the Start Menu. Close all other cmd and Explorer windows.
2.2   Type mkdir c:\pe86\mount  to create an empty folder
2.3   Type dism /Mount-Wim /wimfile:C:\pe86\iso\sources\boot.wim /index:1 /Mountdir:C:\pe86\mount
2.4   You can now use Windows Explorer to edit the image which you will find at C:\pe86\Mount. Note: If using Windows XP, you are advised to hold down the SHIFT key if deleting files or folders in the image.
2.5   Copy the two files which can be found in the AUTO folder contained within the ImDisk.zip download, onto the C:\pe86\mount\windows\system32 folder.
2.6   Commit the changes to boot.wim using the command: dism /Unmount-Wim /MountDir:C:\pe86\mount /commit
        Note:  If you do not want to keep the changes, use /discard instead of /commit.   Read the WAIK .chm help files for more information.

Note: You can convert the WinPE OS files to a .ISO file using oscdimg - at the WAIK command type this command line:

oscdimg -n -m -o -bc:\pe86\etfsboot.com c:\pe86\ISO c:\pe86\winpexp.iso

In the menu.lst, you will need to change the last few lines to:

map /winpexp.iso (0xff)
map --hook
chainloader (0xff)/BOOTMGR

By using WinPE in an ISO file, you can have a multi-boot USB drive that does not need the WinPE boot files in folders on the USB drive itself.

3. Make a  grub4dos bootable USB drive

    3.1 Use RMPrepUSB and a USB Flash or HDD hard disk.
    3.2 If your XP ISO files are larger than 4GB you must format as NTFS. Set 'Boot as HDD' and click '6 prepare Drive'
    3.3 Now click on the 'Install grub4dos' button and press Enter when prompted to copy over the grldr file.

4. Copy the ISO files and WinPE OS files to the USB Drive

4.1 Copy the files from C:\pe86\ISO to the root of the USB drive
4.2 Make a \ISO folder on the USB drive and copy your ISO files to that folder

5. Extract ImDisk.zip and copy the files to the USB drive

5.1 Download the file ImDisk.zip and extract the contents to your USB drive.

6. Copy the \imdisk\menu.lst file on the USB drive to the root of the USB drive

6.1 If you already have a \menu.lst file on your USB drive, you can add the contents of the tutorial menu to your own menu using Notepad.

7. Add/edit the XP install answer files and diskpart scripts as desired

7.1 If your ISO already is automated or semi-automated (unattended) then you should not need to specify an answer file in the menu.lst (see below). If you want an automated install, use the file at \ImDisk\answer\ans.txt as a template - add the correct Product Key and change the Regional settings, TimeZone etc. as required.
7.2 If you want a special partition arrangement, use one of the diskaprt script files at \ImDisk\Diskpart as a template and modify it accordingly.
7.3 If you just want to reformat an existing partition, use the \Imdisk\DISKPART\FmtPtn1.txt script for DP.
7.4 For a manual install, do not  set a value for DP or ANSWER in the menu.lst
7.5 If you want any extra drivers to be added, add them to the COPYFOLDER folder - e.g. if CF=Dell530 then add the network INF, CAT and SYS driver files to \ImDisk\COPYFOLDER\Dell530\$OEM$\$1\Drv\Net.
7.6 If you need to add mass storage drivers (e.g. AHCI drivers) see the section at the end of this page)

8. Edit the \menu.lst file to match your ISO files

8.1 Use Notepad (press F4 in RMPrepUSB) to edit the menu.lst file on the USB disk and change the ISO name and diskpart and answer files names as required

Example menu.lst file

#MYISO=XP ISO file
#DP=diskpart
#ANS=answer file - unattend.txt
#CF=Config folder

title  AUTOMATED INSTALL of Windows XP 32-bit ISO from WinPE for Dell 530\nThis will install Windows XP 32-bit to your hard disk
debug off
set MYISO=XPPROSP3.iso
set DP=50gb_rest.txt
set ANSWER=ANS.txt
set CF=Dell530
dd if=()/imdisk/spaces.txt of=()/imdisk/ISONAME.CMD
write ()/imdisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\nSET ANSWER=%ANSWER%\r\nSET DP=%DP%\r\nSET CF=%CF%\r\n\32\0
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (hd1,0)/BOOTMGR

title MANUAL INSTALL of Windows XP 32-bit ISO from WinPE\nThis will install any edition of Windows XP 32-bit to your hard disk
debug off
set MYISO=XPPROSP3.iso
set DP=
set ANSWER=
set CF=
dd if=()/imdisk/spaces.txt of=()/imdisk/ISONAME.CMD
write ()/imdisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\nSET ANSWER=%ANSWER%\r\nSET DP=%DP%\r\nSET CF=%CF%\r\n\32\0
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (hd1,0)/BOOTMGR

For an attended install or if your ISO already contains an unattended.txt file, simply set ANSWER=  (make sure the are no spaces at the end of the line).
If your ISO contains an unattend.txt file for an unattended install but you want to have an attended (manual) install, then specify an empty answer file (e.g. ANS=empty.txt).
You can choose a diskpart script from the ones in the \ImDisk\diskpart folder or make new ones of your own.
Note that the drive that you want to install the OS onto must be assigned a drive letter of T: by the diskpart script.
You can fully automate the process (dangerous!)  by editing \ImDisk\LOADISO.cmd and \ImDisk\RunWinnt.cmd and remove any 'Pause' commands.
If you convert WinPE into an ISO (see Step 2), you do not need the WinPE boot files on the USB boot disk, just the ISO file and then modify each menu as below:


title  AUTOMATED INSTALL of Windows XP 32-bit ISO from WinPE ISO for Dell 530\nThis will install Windows XP 32-bit to your hard disk
debug off
set MYISO=XPPROSP3.iso
set DP=50gb_rest.txt
set ANSWER=ANS.txt
set CF=Dell530
dd if=()/imdisk/spaces.txt of=()/imdisk/ISONAME.CMD
write ()/imdisk/ISONAME.CMD SET MYISO=\\iso\\%MYISO%\r\nSET ANSWER=%ANSWER%\r\nSET DP=%DP%\r\nSET CF=%CF%\r\n\32\0
map (hd0) (hd1)
map (hd1) (hd0)
map /winpexp.iso (0xff)
map --hook

chainloader (0xff)/BOOTMGR


Adding Mass Storage Drivers (e.g. AHCI)

See here (Step 3 - section 2) for more help on the file structure and answer file settings required. The AHCI/RAID drivers need to be added to TWO folders in your copyfolder structure...

You need to modify your answer file (e.g. unattend.txt) and include the txtsetup.oem and AHCI/RAID drivers in the \ImDisk\COPYFOLDER\Dell530\$oem$\textmode folder as well as ensure the AHCI\RAID drivers are present in one of the OEMPnPDriversPath folders specified in the unattend.txt file (e.g. \ImDisk\COPYFOLDER\Dell530\$oem$\$1\drv\storage). 
Tip: If you have any problems, try omitting any   = "Retail"   entries and use just    = "OEM"   entries. Note that an unattend.txt file for an AHCI system will not also work on an IDE system.

If any problems, boot to an OS (e.g. WinPE) from a USB stick or DVDROM and check the XP Setup log files:
XP creates the following log files:
setupact.log -This log file contains a list of actions in chronological order that occurred during the graphical installation phase, such as file copies and registry changes. The OS also stores setup error log entries in this file. XP writes the setupact.log file to the %systemroot% folder (e.g., c:\windows).
setupapi.log -XP writes information to the setupapi.log file each time a .inf file executes, including any errors. XP writes the setupapi.log file to the %systemroot% folder.
setuperr.log -This log file contains a list of errors that occurred during installation and their severity (this log file should be 0 bytes in size if no errors occurred during installation). XP writes the setuperr.log file to the %systemroot% folder.
comsetup.log -This log file contains installation information about Optional Component Manager and COM+ components. XP writes the comsetup.log file to the %systemroot% folder.
netsetup.log -This log file contains information about workgroup and domain membership. XP writes the netsetup.log file to the \%systemroot%\debug folder.
setup.log -The Recovery Console (RC) uses the setup.log file to gain information about the Windows installation during repair operations. XP writes the setup.log file to the \%systemroot%\repair folder.

Č
ċ
ImDisk.zip
(342k)
Steve Si,
7 Jul 2012 18:28