Well after a few hardware failures at work and many hours rebuilding servers that
are *supposed* to have RAID 5 on them, I’m back online.
(They had RAID enabled at the BIOS level, and there’s a BIOS boot based tool that
let’s you create/delete stripes etc. BUT you need to use the ’Windows’ version of
their tool to ’REPAIR’ the volume. Now if you can’t boot to an O/S.here in lies my
problem I want to plug the new drive in and ’boom’ rebuild done but no!)
I wanted to share a tip which came out of all of this – Creating a Windows
7 Boot WinPE USB Key.
You know the 20 odd things you have lying around and are wondering what you could
do with 1GB, 512MB etc keys.
You can make a boot disk out of themcool (provided your machine supports booting
from USB, unlike my mac_mini at home running Windows 7 🙂
You could make an x86 boot and on another create a x64 AND you can still store your
data.
It’s not too tough really – couple of things you need upfront
- USB Key, drive or whatever
-
Windows
Application Installation Kit for Windows 7 RC (WAIK) – free download with the
WinPE ’image’ in it and all the tools (a WIM file) - Some of your favourite recovery tools to add to your usb key
Ok good to go.
Let’s start
- Install the WAIK on your local machine – it installs folders for x86, amd64 and i64cool
-
From the Start Menu->All Programs->Microsoft Windows AIK->Deployment Tools
Command Prompt -
Execute the command copype x86 c:\PEBuild (replace x86 for amd64 if
you want 64bit. This will create the directory c:\PEBuild and copy the required files
to get started. -
You’ll notice now that you should be in the C:\PEBuild folder – this
is our ’working space’ and there will be a couple of sub-directories here. -
Let’s mount the Image so we can manipulate files, and then later
save them back into the Image for deployment, as follows: -
run the command imagex /mountrw
winpe.wim 1 mount (this will mount the vanilla winpe.wim and create a ’mount’ directory
for us to use)- this didn’t work for me on 2 machines that I tried as follows (I was pretty happy)
if this works for you - then great, it’s meant to. :-) (there maybe open files etc)
Fortunately I had a PLAN B that works regardless (alot of the documentation
use ImageX)Issue the command from the C:\PEBuild dir:
dism
/mount-wim /wimfile:winpe.wim /index:1 /mountdir:c:\PEBuild\Mount
-
Go to the Mount Directory to see several folders – if you used my
PlanB approach you can store the files in Program files if you like, or wherever.
If you need access to the Startup folder it’s hidden in the same
dir as Program Files.Copy your Win32/64 tools and utilities here to the mount dir (once fully booted up
with WinPE, you will be in a RamDisk with the drive letter of X: – good idea to always
use environment vars to get special folders if you need to)You can add other support like scripting, powershell etc – check out the packages
- Once done – commit the changes to the WinPE.wim with the command
- ImageX Cmd: imagex /unmount /commit /c:\pebuild\mount
-
dism Cmd: dism /unmount-wim /moundir:c:\pebuild\mount /commit
- Almost done 🙂
-
Copy the now *modified* WinPe.Wim image file to the correct directory (and we rename)
so it runs smoothly in the boot sequence. Run copy /y winpe.wim iso/sources/boot.wim
-
(optional step) To create an ISO of your work, issue the following command:
ocsdimg -n -b”c:\Program Files\Windows AIK\Tools\x86\boot\etfsboot.com” c:\PEBuild\ISO
c:\PEBuild\WinPE.iso
-
Next let’s add our good work to our USB key and we’re done (WE WILL ERASE YOUR KEY
– back it up if needed. you can copy your stuff back on when we’ve finished) -
Plug your USB key in and we’re going to ntfs format it, create an active primary partition
and assign a drive letter to it. - From your command prompt use diskpart as follows:
- c:\PEBuild\diskpart
-
list disk (you should see your USB drive come up in the list – this
is the drive # to work with e.g. 1) -
sel disk 1 (double check from the previous command on what disk number
your USB is on – mine is 1) - clean
- create part primary
- sel part 1
- format fs=NTFS QUICK
- assign
- exit
- viola! your usb is now prepared.
-
We need to do 2 final steps – copy everything within the ISO directory
straight to your USB key. e.g. c:\PEBuild\ISO (from Explorer you’ll
be able to get to your USB Key easily through the SendTo right mouse menu)Take note of your USB Key’s DRIVE letter
- Write the ’bootsector’ as follows:
-
c:\program files\Windows AIK\Tools\PETools\x86\bootsect /nt60 <drive
letter of your USB Key>
>
>
>
Hopefully I’ve saved you some time and pain.. happy booting.