How to add a boot from VHD to Windows Server 2008r2 or Windows 7 computer
Batch file follows
We will be backup up your current Boot configuration to c:\Boot _backup\
and store VHD in the c:\vhd
for this demo we use the name with the actual file name of
Win7Ult.vhd
and add entry in the boot manager of "Windows 7 Ultimate - VHD Boot of Windows 7 Ultimate, 32 bit"
-----------------------------
@echo off
Echo : This command should be run from an elevated command prompt, and you should
Echo : have administrator rights on your local system.
Echo :
Echo : *** You should have Windows 7 installed as the base OS on your system. ***
Echo :
Echo : Your existing boot configuration will be backed up to c:\boot_backup\BCDBACKUP.
Echo :
Echo : One new boot entry will be created.
Echo : Windows 7 Ultimate - VHD Boot of Windows 7 Ultimate, 32 bit.
Echo :
Echo ------------------------------------------------------------
Echo Press CTRL+C to cancel, or
Pause
Echo Backup BCD Database
BCDEdit /Export c:\Boot _backup\BCDBACKUP
IF NOT EXIST c:\Boot _backup\BCDBACKUP. (
Echo BCD Backup Failed
Echo Press CTRL+C to cancel or
Pause
) Else (
Echo BCD Backup Completed
)
ECHO Testing to verify VHD Files Available.
IF NOT EXIST c:\VHD\ Win7Ult.vhd.VHD (
ECHO NOT FOUND: Win7Ult.vhd
Echo Press CTRL+C to cancel or
Pause
)
Echo Creating VHD Boot Entry for Windows 7 Ultimate
Start /W c:\VHD\Boot2VHD Win7Ult.vhd "Windows 7 Ultimate - VHD Boot of Windows 7 Ultimate, 32 bit"