Installing Windows Vista/7 the lazy way!

Warning:  This information comes without a warranty.  I wont guarantee support if you break your hardware.  Im not responsible for anything you do with this information.  For entertainment purposes only.  I`m probably lying.

1.  Obtain your Windows ISO.  Probably using MSDNAA or something.

2.  Make sure your hard drive is partitioned properly.  This means leaving one partition open for windows.  Make sure it`s easily identifiable from the windows installer(I give Windows 120GB of my 160GB drive).  For this demonstration, I will use the 1st partition on my 1st disk(referred to as sda1).  You can create a partition for this by using the GParted application to shrink a partition, then use the free space to create the windows partition.

3.  Ensure you have the necessary software installed.  All you need here is KVM.  In Ubuntu, the package is called qemu-kvm.  So sudo apt-get install qemu-kvm from a terminal.  That`s it.

4.  From a Terminal, issue the following command.  kvm -hda /dev/sda -cdrom /home/you/windows.iso -m 768 -boot d.  This command starts up a virtual machine using the physical disk sda(this can be the drive you`re currently booted from!).

5.  Proceed with the Windows install as normal, formatting your selected Windows partition.

6.  Allow the installer to reboot and finish the installation.  Afterwards it will leave you at a stock Windows desktop.  This is the time that you want to go download all of the drivers for your hardware, install Firefox, etc.

7.  Click the Windows Logo, goto Programs -> Accessories, right-click on Command Prompt, and click Run as Administrator.  Acknowledge the UAC.

8.  In the prompt type cd sysprep, hit ENTER, then type sysprep.exe, and hit ENTER again.  A dialog box should appear.  Ensure that the System Cleanup Action drop-down box has Enter System Out-of-Box Experience (OOBE) selected.  For the Shutdown Options drop-down box, select the Shutdown option.  Click OK.  Your VM will spin away doing it`s happy things, getting Windows all prepared to accept your physical hardware instead of the virtualized hardware.  Let the virtual machine shut itself down.

Your system is in a precarious state now.  Windows has been greedy and overwritten your Master Boot Record without asking you(Thanks MS!).  If you reboot right now, you`ll need a USB drive to reinstall grub to boot into Linux again.

9.  In your terminal, type sudo update-grub.  It should mention something such as Found Windows 7 (loader) on /dev/sda1.  Next youll want to issue a sudo grub-install /dev/sda` command, which should say “Installation finished.  No error reported.”.

10.  Installing GRUB again is dandy, but might not be enough to successfully boot a system.  For the last step we’ll need to use GParted or fdisk to change Linux to be the bootable partition again.  On my system, Linux is installed on sda3.  Using GParted, you simply right-click on the Windows partition, click Manage Flags, and uncheck the boot option.  Do the same thing for your Linux partition, but ensure the boot option is checked.  Click the big green Checkbox in the menubar, and all should be well.

Now you should be able to reboot and select Windows from your GRUB menu!