In test environments, it is useful to have a WinPE boot option in windows boot menu. Booting to WinPE would allow you to look at the filesystem in case if the computer is not booting and more importantly, it will help easy refreshing of the system by restoring a fresh image. Having a PXE server in your network too, would equally be useful in terms of booting to preOS environments.
I had a WinPE build, created using the latest version of WAIK (Windows Automated Installation Kit) . If you don't have WinPE, search for AIK , which is a free download from Microsoft. It is not difficult to build WinPE using WAIK, and lot of help in the net!
This is all I had to do.
Copy boot.sdi file
If you install Windows 7 using the default settings, it would have created a small partition to hold boot files. This is usually 200MB, and no drive letter assigned. If you don't have this small partition, skip step fist and last step. All files will be in C: in that case.
- Start diskmanager and assign a drive letter to the boot partition
- Boot files are in the "\boot" folder in that partition. This is a hidden folder, but from a CMD window, you can go to the folder with 'CD \boot' command.
- Files in the boot are not hidden. It has most of the boot files necessary but not boot.sdi file. Copy this to the \boot folder from WinPE build's boot folder.
- Now we are done with the hidden partition, go to diskmanager and remove the driver letter for that partition. Otherwise it will continue to mount it all the time.
Copy the .Wim file
The boot image or WinPE, WinPE.wim file can be found in the WinPE built created from AIK. Copy the .wim file from the WinPE build to a convenient location in the system. You may have enough space in the boot partition (it is 200MB but there are no many files), but try to avoid it. You can create a new folder in drive C: and use it to hold your .wim as well as .vhd in time to come! Say your Windows partition is C: and the name of the .wim file is winpe.wim, and copied it to C:\Images.Add an entry to BCD
Usually, the {ramdiskoptions} entry is not created when installing Windows. Just make sure if it is there or not with the following command.
bcdedit /enum {ramdiskoptions}
If it says "There are no matching objects or the store is empty", that indicates {ramdskoptions} entry has not been created. Create it with the following commands.
bcdedit /create {ramdiskoptions}
bcdedit /set {ramdiskoptions} ramdisksdidevice boot
bcdedit /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi
Now, create the actual entry with following commands.
bcdedit /create /d "WinPE boot" /application osloader
After successfully creating the entry, this will display the {GUID} of the entry in format {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. Use that value in the following commands.
bcdedit /set {GUID} device ramdisk=[C:]\Images\winpe.wim,{ramdiskoptions}
bcdedit /set {GUID} osdevice ramdisk=[C:]\Images\winpe.wim,{ramdiskoptions}
bcdedit /set {GUID} systemroot \Windows
bcdedit /set {GUID} detecthal Yes
bcdedit /set {GUID} WinPE Yes
Finally, add it to the current boot options list with
bcdedit /displayorder {GUID} /addlastReboot the system and select WInPE boot to boot to WinPE
bcdedit /deletevalue {ramdiskoptions} description
Surprisingly, you can boot the same machine to 32 bit WinPE as well as 64bit (if the machine is 64bit.) just by using the appropriate WinPE.wim. They can be in the same menu, no other files need change.
Notes:
- In boot menu, if "Ramdisk Options" is displayed instead of the description of WinPE, remove the description of the {ramdiskoptions} with the following command.
- If booting to winpe fails and says "A required device is not accessible", check if you have copied the boot.sdi file to the correct location.
No comments:
Post a Comment