0

There are several answered questions about how to get the Windows OS Product Key like Get windows details like product key, domain name, user name, etc., but I was wondering how to programmatically get the Product Key for a piece of installed software. Uninstall Registry Key is really nice as it has a lot of attributes tied to an installed program, but none of the attributes involve a Product Key so I was wondering if there's some other means via some C# library or some such to get the Product Key for an arbitrary piece of software and how to get it via C#.

Kurt Wagner
  • 3,295
  • 13
  • 44
  • 71
  • Why do you want to get product key? Most uses of that seem rather nefarious. – Gul Ershad Jul 04 '15 at 18:17
  • I'm planning on developing an open source application that outputs a csv with a list of installed programs and product keys in the case a persons Windows migration to Windows 10 goes bad and they want something to easily defer to install the programs they previously had (I myself personally keep such a list in the cloud sorted by priority of installation). – Kurt Wagner Jul 04 '15 at 18:28

2 Answers2

0

There's no standard way that every program stores it's product key or licensing. For example, you can recover the Office product key from 2010 and prior, but with 2013, I do not believe it's possible. Many products have the activation details either encrypted in the registry or using a cloud-based solution (Office 365, Adobe CC). You can try to research the individual products you would like to target to get a better sense of how each program is handled.

Ron Brogan
  • 892
  • 1
  • 9
  • 25
0

You could open the different registry hives and search them recursive for "keywords" like:

  var reg = Registry.LocalMachine.OpenSubKey("Software");
    SearchRecursive(reg);
    ...
    private void SearchRecursive(ReigstryKey reg)
    {
       var subkeys = reg.GetSubKeyNames();
       var values = reg.GetValueNames();
       foreach (var value in values)
       {
          ...
       }
    }
  • Serial
  • ProductID
  • DigitalProductId ....

I think You'll need some kind of filter at the end, there might be a lot of "wrong hits".

thardes2
  • 1,162
  • 12
  • 28