Will formatting HD and installing my own OS invalidate the warranty on laptops?

no, installing a different operating system will not void the warranty. however, you may not be entitled to driver and software related technical support if you're using another OS.

and no, it would not be legal to use an OEM license with a virtual machine as it is technically speaking a different computer with different hardware (although virtualized).