For Windows7, at least, most big brands had their license hard coded into the BIOS. Read up on SLIC(Software License Internal Code) BIOS's if you're interested.
Basically, you just need to lay your hands on an OEM Windows7 install disc and it should be activated as soon as you install it. At least, that's how I remember it- I haven't installed Windows on anything in at least a year.
*cough*cough*LinuxMint*cough*cough* ~D
*Seriously though, if Windows is giving you trouble, check out Mint19- it's pretty sweet.