A good way to find product key codes is by using Magical Jelly Bean Keyfinder software or the Mac Product Keyfinder. New Windows 8 PCs have their product keys stored in the UEFI firmware or BIOS, so the product key gets automatically retrieved if that same Windows edition gets installed.
Magical Jelly Bean keyfinder is a freeware tool that can be used to retrieve the product key or CD key of your Windows install or other applications. The premium version can find a bigger list of product keys, such as those of Adobe products. It comes with other advanced options, such as the ability to retrieve product keys from unbootable Windows systems.
The Mac Product Keyfinder retrieves keys from Mac OS X-based PCs. It scans the Mac for any software and allows you to save their keys in CSV, text or PDF format with the freeware version. It can also locate product keys from other Apple products, such as iPads or iPhones that were previously connected to iTunes. The premium version scans Time Machine backups for keys and expands the number of keys that are retrievable to 200.
PCs that use the SLP or System Locked Pre-installation technology have their product keys printed on stickers called Certificates of Authenticity, or COAs. It's located on the bottom side of a laptop, on the desktop computer or its power supply.