Why can’t I get python to read RegisteredOwner registry key?

  python, registry, windows

I ran this piece of code, which returned the Product Id reg key like it should:

from winreg import *

def regstuff():
    for i in range(1024):
        try:
            RawKey = OpenKey(ConnectRegistry(None, HKEY_LOCAL_MACHINE), "SOFTWAREMicrosoftWindows NTCurrentVersion")
            asubkey_name = EnumKey(RawKey, i)
            asubkey = OpenKey(RawKey, asubkey_name)
            val = QueryValueEx(asubkey, "ProductId")
            print(f"[Product ID]        {val}")
        except:
            pass

but then I changed "ProductId" to "RegisteredOwner" and now it doesn’t return anything. It’s only able to get the ProductId reg key. I have no idea what I’m doing wrong.

Source: Windows Questions

LEAVE A COMMENT