You will need a Live CD to recover GRUB after windows installation. I assume that you are going to recover an UBUNTU Box. Boot the Live CD and go to the terminal. And continue by entering:
$ sudo fdisk -l
This will ask your password, just enter it and press enter key. It will give you output like this:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 6768 54256640 7 HPFS/NTFS
/dev/sda3 6768 38913 258207585 f W95 Ext’d (LBA)
/dev/sda5 6768 9318 20480000 83 Linux
/dev/sda6 22372 38913 132873583+ 7 HPFS/NTFS
/dev/sda7 9319 22371 104848191 7 HPFS/NTFS
Now i will mount Linux (sda5 here), i have no external boot partition as you can see.(IF YOU HAVE external one, do not forget to mount it! )
$sudo mount /dev/sda5 /mnt
$sudo mount --bind /dev /mnt/dev
$sudo mount --bind /proc /mnt/proc
Now chroot into the enviroment we made :
$sudo chroot /mnt
After chrooting, you do not need to add sudo before your commands because from now, you will run commands as root.
You may want to edit /etc/default/grub file to fit your system (timeout options etc)
#nano -w /etc/default/grub
Play with the options if you want.(But do not forget to give grub-update command if you saved it
)
Now install/recover Grub2 via :
#grub-install /dev/sda
command.However you may get errors with that code like me.If so please use this command :
#grub-install --recheck /dev/sda
Now you can exit the chroot, umount the system and reboot your box :
#exit
$sudo umount /mnt/dev
$sudo umount /mnt/proc
$sudo umount /mnt
$sudo reboot
Source: http://www.ubuntu-inside.me/2009/06/howto-recover-grub2-after-windows.html