Monday, October 31, 2011

How to create a winpe boot-able USB flash drive

I was trying to automate the OS installation. And when I googled around, I could see so many links asking to play with winpe. When I explored winpe, I was amazed to see such a wonderful small image developed by Microsoft. You can say a mini windows Vista.

So what if Vista is not a hit, but because of Vista, we got such a wonderful image which makes our life much more easier.

Now to create a winpe boot-able USB, we need to have a boot-able USB drive and a winpe image.

Let me first dig into creating a boot-able USB flash drive.
Steps to follow:
Now here is how we can prepare USB Flash Drive.
Connect the flash drive to the system.
Open a command prompt and run the following command:
#> diskpart (opens the diskpartition command line utility. in case of win7 and vista, run as administrator.)
When you see the prompt "DISKPART>" type in the following command to verify which disk is the USB Flash Drive:

list disk (We should see a listing of disks based on size)
Type in the following commands (Important: this assumes that USB flash drive was listed as "Disk 1" , assuming there are only 2 disks in the system. And the boot disk is always the Disk 0.)

select disk 1
clean
create partition primary
select partition 1
active
format quick fs=fat32
assign
exit

This prepares the flash drive and just by copying the winpe files into the flash drive will complete the process of creating the winpe boot-able flash drive.

Note: Diskpart is a command line utility available in all versions of windows after windows XP.
We can also script it as below. Keep the below command in a txt file named diskpart.txt.

"list disk
select disk 1
clean
create partition primary
select partition 1
active
format quick fs=fat32
assign
exit
"
In the command prompt type below command to complete the whole process.
diskpart /s diskpart.txt