0

I am trying to get the OS information from registry through ProductName key in HKLM\Microsoft\Windows NT\CurrentVersion but it does not seem to be present in my C# application in Windows Sandbox. However, when I check the registry value by manually opening the regedit, it is present.

Are there any possible solutions for this?

I have tried getting information through following code:

  var registry = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
  string productName = registry.GetValue("ProductName").ToString();

registry.GetValue("ProductName") seems to be null but it is present when I manually open the registry editor.

CaesarMyMate
  • 98
  • 1
  • 6

1 Answers1

0

I just figured out.

In x64 systems, Registry key is accessed from HKLM\Software\WOW6432Node. ProductName was not present there, hence I was unable to access the value.

CaesarMyMate
  • 98
  • 1
  • 6