I wanted to create one virtual machine and use (boot) it on an other machine, but I was getting a Blue Screen Of Death (BSOD) every time I booted the virtual machine, even if I created the VHD in the Microsoft Windows 2008 R2 Hyper-V manager and tried to natively boot on that same machine from the virtual machine.
Cause
This was caused by the fact that I was using a RAID configuration on Machine A and also on Machine B and the RAID drivers where not supplied on the Windows 7 DVD. All drivers needed to boot Microsoft Windows 7 should be available on the virtual machine before you try to boot from the vhd.
Solution
Even if you are not using RAID configuration, best practice is to sysprep you’re virtual machine before you try to boot it on an other machine. If you’re using a RAID configuration, special graphics drivers or other drivers not on the Microsoft Windows 7 DVD, use dism.exe found in the “Windows Automated Installation Kit (AIK) for Windows® 7” to add drivers to you’re syspreped vhd.
These are the steps I used to boot from a VHD containing Microsoft Windows 2008 R2 or Microsoft Windows 7 on an other machine without getting the BSOD:
Creating the Virtual Machine
- Machine A has Microsoft Windows 2008 R2 with hyper-v role installed
- Create a Virtual Machine on Machine A, by using the hyper-v manager (Start > Administrative Tools > Server Manager > Roles > Hyper-V Manager. Make sure the disk is fixed to a maximum size (for example: 50GB). Machine B should have at least 50GB free disk space else the vhd won’t boot.
-
Create the virtual machine on C:\VHD\NotSysPreped, path to VHD should be C:\VHD\NotSysPreped\MyMachine.vhd
-
After installing Windows 7 or Windows Server 2008 R2 on it and after installing all you’re programs (except anti virus), shutdown the virtual machine
-
Download the Windows Automated Installation Kit (AIK) for Windows® 7 :http://www.microsoft.com/downloads/details.aspx?familyid=696DD665-9F76-4177-A811-39C26D3B3B34&displaylang=en
-
Install the Windows Automated Installation Kit (AIK) for Windows® 7 on Machine A, because we need the dism.exe tool. You could also use a tool like Virtual CloneDrive to copy the tool out of the downloaded *.iso file.
-
I will boot this virtual machine once a week to update it with the last Windows Updates (keeping this Virtual Machine up to date)
Pre-pair the Virtual Machine
Every time you want to use a copy of this virtual machine on other machine, execute the following steps:
-
Shutdown the Virtual Machine on Machine A
-
Copy the file C:\VHD\NotSysPreped\MyMachine.vhd to C:\VHD\SysPreped\MyMachine.vhd. We create a copy of the vhd, because we want the original virtual machine to keep working.
-
Create a new Virtual Machine based on the copied C:\VHD\SysPreped\MyMachine.vhd file
-
Boot this new Virtual Machine
- In the Virtual Machine execute C:\Windows\System32\sysprep\sysprep.exe
- Choose Enter System Out-of-Box Experience (OOBE)
- Check “Generalize”
- Choose “Shutdown”
- Press OK
The following steps are only needed when you are using drivers on Machine B, that are not supplied on the Windows 7 DVD (for example: when you are using a RAID configuration).
-
After the virtual machine has shutdown, run CMD on Machine A
-
Attach the C:\VHD\SysPreped\MyMachine.vhd file, so it can be used by the dism.exe tool:
-
In the cmd dialog enter:
-
diskpart
-
select vdisk file=C:\VHD\SysPreped\MyMachine.vhd
-
attach vdisk
-
assign letter=v
-
exit
-
Copy you’re RAID drivers to Machine A on C:\Drivers
-
Add RAID drivers by using the dism.exe tool:
-
In the cmd dialog enter:
-
dism.exe /image:V:\ /Add-Driver /driver:C:\Drivers\mydriver.inf
Booting from the Virtual Machine on Machine B
-
Machine B must be running Windows Server 2008 R2 or Windows 7
-
Boot Machine B
-
Copy the C:\VHD\SysPreped\MyMachine.vhd from Machine A to Machine B C:\VHD\SysPreped\MyMachine.vhd
-
Edit the boot manager by using the bcdedit.exe tool:
-
bcdedit /copy {current} /d “MyMachine Description”
-
The previous statement returns a GUID like: {aa2e3972-7a31-11df-987b-b52175dc348f}
-
bcdedit /set {aa2e3972-7a31-11df-987b-b52175dc348f} device vhd=[C:]\VHD\SysPreped\MyMachine.vhd
-
bcdedit /set {aa2e3972-7a31-11df-987b-b52175dc348f} osdevice vhd=[C:]\VHD\SysPreped\MyMachine.vhd
-
bcdedit /set {aa2e3972-7a31-11df-987b-b52175dc348f} detecthal on
-
bcdedit /set hypervisorlaunchtype auto
-
The previous statement is only needed when the virtual machine is running Microsoft Windows 2008 R2 with the hyper-v role enabled.
-
Reboot Machine B
-
After rebooting you should see two entries one with the description “Windows 7” and an other with the description “MyMachine Description”
-
You should now be able to boot the virtual machine on Machine B without getting the BSOD!
“Edit the boot manager by using the bcdedit.exe tool…” this is the most crucial part that i have missed out!!
Dude!. Thanks for sharing this