The Sysadmin Notebook  

Sitemap

Boot Configuration

Controlling Windows 7 Boot Options

Contents

With Vista, Microsoft changed the mechanism for configuring bootup. The traditional boot.ini file, was replaced with a Boot Configuration Datastore or BCD. The BCD is configured using the command-line tool bcdedit.

bcdedit needs to be run with elevated priviledges.

BCDedit Examples

Top Bottom
bcdedit
lists current datastore settings - same as "bcdedit /enum"
bcdedit /copy {current} /d "Windows Vista Alternate Boot"
copies the current boot configuration to a new entry named "Windows Vista Alternate Boot"
bcdedit /set {configname} systemroot windowsvista
change value for systemroot in {configname} to "windowsvista". Can be used to change values of any field listed by "bcdedit /enum"
bcdedit /set {configname} removememory 256
reduces total memory available to {configname by 256MB
bcdedit /set /bootsequence {configname}
makes {configname} the default boot configuration for the next boot only. Useful if you wish to try a change and then revert back to the original configuration on next boot
bcdedit /default {configname}
permanently change the default boot configuration
bcdedit /timeout 15
change the boot menu timeout to 15 seconds. Turns on the boot menu even if BCD has only one entry. Useful for buying time to reach recovery console.
bcdedit /export c:\exportfolder\exportfilename
export current configuration to "exportfilename" for backup purposes
bcdedit /import c:\exportfolder\exportfilename
restores BCD from backup file
bcdedit /set {configname} debug on
turns on kernel debugger for {configname}
restore the boot menu option for an existing Windows XP installation
bcdedit /create {ntldr} -d "Menu Description"

Recovery Console

Top Bottom

Reached by pressing "F8" as boot configuration is loaded

System Boot Sequence

Top Bottom

The startup process with Windows 7 runs as follows:

  1. When the machine is powered on it performs a Power-On Self-Test (POST)
  2. The BIOS reads the MBR of the boot device, and transfers control to the MBR
  3. The MBR reads the boot sector which contains the code to start Bootmgr
  4. Bootmgr reads the content of the BCD to build and display the Boot Menu
  5. If the current Windows 7 installation is selected, Bootmgr starts Winload.exe found in %SYSTEMROOT%\system32
  6. Winload.exe starts by loading Ntoskrnl.exe and Hal.dll
  7. Registry settings are read
  8. Drivers are loaded
  9. Smss.exe is started
  10. Smss.exe starts Wininit.exe
  11. Wininit.exe starts Lsass.exe and Services.exe
  12. The logon screen is displayed

If you choose to resume from hibernation, Bootmgr loads Winresume.exe at step 5 to restore the systems state prior to hibernation.

Each time you install a Windows operating system it rewrites the MBR to call it's own bootloader. To restore the Windows 7 bootloader to the MBR, insert the Windows 7 DVD and run:

d:\boot\ bootsect.exe /nt60 all