To find the product key for Windows Vista / 7 / 8.x /10, run the following in the command line:
wmic path softwarelicensingservice get OA3xOriginalProductKey
Powershell analog:
powershell “(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey”