Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
windows 7 registry rget "ProductId", empty result
#1
Is there a way to get the product ID (not product key) from the registry?
I used this code, but the result is empty

Macro Macro27
Code:
Copy      Help
rget(_s "ProductId" "SOFTWARE\Microsoft\Windows NT\CurrentVersion" HKEY_LOCAL_MACHINE)
out _s
rget(_s "ProductName" "SOFTWARE\Microsoft\Windows NT\CurrentVersion" HKEY_LOCAL_MACHINE)
out _s

I triple checked that " HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" contains a filled (not empty) string-type "ProductId" key.

The goal is to retrieve a value from the registry that identifies specific PC (a registry key that is always there).
I used 'product ID' because if you right click the "Computer" icon and then select "Properties" you immediately see the Product ID.
I assume that this ID is different for each PC. (a better suggestion, if there is one, is very welcome).
#2
Macro Macro2595
Code:
Copy      Help
rget(_s "ProductId" "SOFTWARE\Microsoft\Windows NT\CurrentVersion" HKEY_LOCAL_MACHINE|HKEY_64BIT)
out _s
rget(_s "ProductName" "SOFTWARE\Microsoft\Windows NT\CurrentVersion" HKEY_LOCAL_MACHINE|HKEY_64BIT)
out _s
HKEY_64BIT is a QM-defined flag, but undocumented.
#3
Thank you for your very fast response.
It works perfect!!!
#4
I don't think that this value is different on each PC.

I would try to get several values - hard disk serial number, MAC address, user SID, computer name, various hardware parts ids, location (from IP). If 1-2 of them changed, it still is the same PS. If all changed, it is another PC.
Or generate a GUID and, store it in registry, and use it as a private unique id of that computer.
#5
Thank for that!
I will try to combine different components like you specified.


Forum Jump:


Users browsing this thread: 1 Guest(s)