An OEM (original equipment manufacturer) license sold with a PC is inseparable from it and it follows the box regardless whether it’s sold, donated or trashed. This is what I learned in 2010 when I had to deal with large donations of PCs in public sector after making sure with the donor, vendors and Microsoft reps that the OS transfer was legit. Don’t trust my experience though, but double-check these facts and make sure you read the rules that apply in your particular case.
The easiest way to recognize a Windows OEM license on major manufacturer PCs is the colorful Microsoft Certificate of Authenticity paper sticker (label) sometimes with an embedded metallic thread and microprint, with particular Microsoft OS name, barcodes and a Product Key that is attached to a computer.
OEM OS license shouldn’t be moved to another hardware or a virtual environment on a different box. The only exception could be if the virtual system is on the same box (for example if you bought a Windows 7 license and wiped your old Windows XP box and then installed XP inside a virtual machine on the same old computer that now has Windows 7). On the other hand, if you have a standalone OS license, you can move it to whichever hardware or virtual session you want.