Before you try to format and reinstall Windows 7, you may need to find out what your product key is. There used to be a way where you could find the product key in the system registry, but the data is encrypted now. The easiest way to get the product code is to find a program that does it for you.
The best one I’ve found is Magical Jelly Bean Keyfinder. The program supports command line options and will also provide serial keys to Microsoft Office products.