03 - How to install Windows XP from a bootable USB drive


Unique hits tumblr statistics
This tutorial describes how you can boot to WinPE v2 or v3 from a USB drive on your 'target' system, then partition and format the hard disk and then install XP onto that hard disk. This method is slow as you have to run the complete Win XP Setup process, both the text mode part and the GUI part, which takes about 20-30 minutes.

You can choose from several different XP installations by placing each i386 XP CD source folder into a separate folder on the USB drive and installing the one that you want onto the target hard drive.

Note:For a similar single-boot method that uses Windows XP ISO files, see Tutorial #82.
You can also make an Easy2Boot MultiBoot USB drive and just copy all your Windows ISO files to it and install Windows.

Outline of the Method
  1. Create a bootable WinPE USB drive
  2. Copy any Microsoft Windows XP CD (or XP ISO contents) to a folder on the USB drive
  3. Boot using the USB drive on the target system and wipe, partition and format the hard disk
  4. Copy the XP (32-bit version) files to the hard disk from the USB drive
  5. Run winnt32.exe (the file will be on the hard disk after copying from the USB drive)
  6. Reboot and allow XP Setup to continue

1. Download and install the Windows 7 WAIK to obtain the ImageX utility and WinPE files
For instructions on how to do this, please refer to the first part of my tutorial here or follow the Make_PE3 tutorial.
Follow the instruction up to the point where a WinPE folder has been created (Step 1)
You can create either an x86 version (recommended) or an amd64 (64-bit) version.
Create a new folder C:\MYXP on your office computer.
Copy the c:\pe86\ISO folder contents to C:\MYXP (C:\MYXP should now contain bootmgr, folders \boot, \sources, \efi, etc.)

2. Obtain a Microsoft Windows XP installation CD or ISO or set of NLited files that you wish to install
    Create a new folder on your Windows (office computer) hard disk called C:\MYXP\XPPRO\i386  (assuming you have XP Professional)
    Copy all the files in the CD's i386 folder to C:\MYXP\XPPRO\i386 folder
    Ensure that the file C:\MYXP\XPPRO\i386\unattend.txt is present and has been correctly modified by you (see end of this page for an example)

Note: XP does not contain AHCI or some SCSI/SATA drivers - either you must set your BIOS menu for Hard Disk mode to  'compatible/legacy' hard disk mode or you must use a specially modified version of XP (e.g. use nLite).

Now prepare a WinPE v3 (bootmgr) bootable USB drive using RMPrepUSB and copy over the C:\MYXP folder to the USB drive -  please refer to the part 2 of my tutorial here. Note: NTFS formatting is recommended for speed.

The USB drive should now contain an \XPPRO folder as well as the winpe folders: \sources, \boot, etc.

3. Boot from the WinPE USB drive using the target system that you wish to install Windows XP onto.

    Now run DISKPART and type the following commands (assuming you want a two partitions on the hard disk) - only type the commands in red:

    DISKPART                                                  run diskpart utility
    LIS DIS                                                       lists the disks present
    SEL DIS 0                                                  select disk zero  (usually the first hard disk)
    CLEAN                                                       wipes the selected disk
    CRE PAR PRI SIZE=30000 ALIGN=16065     create a 30GB primary partition for XP (change as required) - if this gives an error use 64260 instead of 16065.
    FOR QUICK  LABEL=SYSTEM                    format it as NTFS (add FS=FAT32 if you don't want an NTFS partition)
    ASSIGN  LETTER=J                                    assign it the drive letter J:
    ACT                                                           make it the boot partition
    CRE PAR PRI                                            create another NTFS partition of remaining size (optional)
    FOR QUICK                                               format it  (optional)
    ASSIGN                                                    assign it a drive letter  (optional)
    LIS VOL                                                    list volume letters
    EXIT                                                          quit diskpart

you now should have a formatted hard disk ready to receive files.

5. Now you need to run winnt32.exe from the drive containing the source i386 folder (e.g. if D: is the USB drive)  to start the copy of the XP install files to the hard disk as follows:

D:\i386\winnt32.exe /unattend10:J:\i386\unattend.txt     /syspart:J:    /tempdrive:J:     /makelocalsource 

(thanks to João Santos for the tip of adding /makelocalsource!). 

To install a different XP source - e.g. D:\XPHOME\i386  or D:\XPPRO\i386 just change the winnt32.exe path accordingly.

/makelocalsource - Instructs Setup to copy all installation source files to your local hard disk. Use /makelocalsource when installing from a CD to provide installation files when the CD is not available later in the installation. The i386 files will be taken from the same folder that winnt32.exe is located when it is run.

/noreboot - Instructs Setup not to restart the computer after the file-copy stage of Setup finishes, so that you can execute another command.

/syspart - On an x86-based computer, this parameter specifies that you can copy Setup startup files to a hard disk, mark the disk as active, and then install the disk onto another computer. When you start the computer onto which you have installed the disk, it automatically starts with the next phase of Setup. You must always use the /tempdrive parameter with the /syspart parameter.
You can start Winnt32.exe with the /syspart option on an x86-based computer running Windows NT 4.0, Windows 2000, or Windows XP Professional. The computer cannot be running Windows 95, Windows 98, or Windows Millennium Edition.

/tempdrive - Directs Setup to place temporary files on the specified partition. For a new installation, Windows is installed on the specified partition. For an upgrade, the /tempdrive option affects the placement of temporary files only; the operating system is upgraded in the partition from which you run Winnt32.exe.

/unattend[num]:[answer_file]
Performs a fresh installation of Windows in unattended mode using the specified answer file. Setup downloads the Dynamic Update files from the Windows Update Web site and includes these files in the installation. The specified answer_file provides Setup with your custom specifications.

http://technet.microsoft.com/en-us/l.../cc782342.aspx


5. When the setup phase completes and returns you to the command line you can reboot by typing:
    wpeutil reboot

Now remove the USB drive and allow the target PC to boot and start the textmode 1st setup phase. Note that unless you have added AHCI drivers (or press F6), the BIOS must be set to IDE (compatible) mode or you will get the dreaded BSOD 0x0000007b error!

TIP: The XP files are many and the file copy is thus quite slow (and very slow if using FAT32 on the UFD). You can speed this up by using 7zip instead of a file copy. Just zip up the XPPRO folder and place the zip file on your USB drive instead of the XP I386 files, then extract the files to the hard disk using the 7zip e or x option. You can also extract a zip file from a network as pulling a zip file across a network is a lot less data than pulling over all of the i386 files and therefore much faster! Remove the /makelocalsource switch if you do this.



Tip: You can easily automate the steps from 3 to 6 - e.g.

diskpart /s dp.scr
xcopy /herky \XPPRO\i386\*.* J:\i386\*.*
J:
cd \i386
winnt32 /unattend10:J:\i386\unattend.txt /syspart:J: /tempdrive:J: /s:J:\i386 /noreboot
echo Finished - please remove your USB drive now!
wpeutil reboot


where the file dp.scr contains the diskpart commands in step 3 (except for the first DISKPART line, of course).


WinPE has
networking

The i386 files do not need to be on your USB drive, they can be on any networked computer. Just create a shared folder on your 'office' PC  (or server) - right-click on the C:\MYXP folder and choose 'share with' to share it out.

The WinPE USB drive will need to have the correct network drive for the target system.
To install the correct network driver when you have booted to WinPE from your USB pen, type DRVLOAD F:\WIN7DRIV\xxxxx.inf  where the USB drive folder F:\WIN7DRV contains the correct win7 driver files (.inf, .sys, .dll, .cat etc.) for your hardware (wait a minute or so afterwards for networking to start up). Now connect to your networked shared folder on your office PC using the command: 
NET USE N: \\mypc\MYXP U:myworkgroup\myloginname  [Enter]
and then type in your password when prompted. 
Now dir N:  should list the contents of the MYXP folder on your office computer. So you can now install any XP image across the network and you don't need the XP files on the USB drive at all, just change the XCOPY source folder in the example above to point to your N: network folder.

Another tip is to back up the XP install once it has finished installation. Then you can easily and quickly restore your XP install at any time in the future - see Tutorial #1 for details!


SAMPLE UNATTEND.TXT FILE FOR UK

;SetupMgrTag
[Data]
    AutoPartition=1
    MsDosInitiated="0"
    UnattendedInstall="Yes"

[Unattended]
    UnattendSwitch=Yes
    WaitForReboot=No
    UnattendMode=FullUnattended
    OemSkipEula=Yes
    OemPreinstall=Yes
    TargetPath= *
;Driver INF files placed in the following folders will be automatically installed
    OEMPnPDriversPath = "Drv\Net;Drv\Audio;Drv\monitor;Drv\Storage;Drv\Video;Drv\Mbd;Drv\Modem;Drv\Misc"

[UserData]
    FullName="Ted"
    OrgName= "Ted plc"
    ComputerName= *
;put your product key on the next line or delete the next line
    ProductID=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    
[GuiUnattended]
    AdminPassword=*
    OEMSkipRegional=1
    TimeZone=85
    OemSkipWelcome=1
    AutoLogon=Yes
    AutoLogonCount=99

[TapiLocation]
    CountryCode=44

[RegionalSettings]
    LanguageGroup=1
    Language=00000809

[Display]
BitsPerPel = 16
XResolution = 800
YResolution = 600
VRefresh = 70

[Identification]
    JoinWorkgroup=WORKGROUP

[Networking]
    InstallDefaultComponents=Yes

[GuiRunOnce]

[Branding]
BrandIEUsingUnattended = No
IEBrandingFile = install.ins