Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8045893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:39:52+00:00 2026-06-05T05:39:52+00:00

I have SQL Server installed. In the registry, the key MSSQLServer at *HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft* looks

  • 0

I have SQL Server installed.

In the registry, the key MSSQLServer at *HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft* looks like this:
enter image description here

All of the following lines of code return values from the registry:

    var mainKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("MSSQLServer");
    var subKey1 = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("MSSQLServer").OpenSubKey("Client");
    var subKey2 = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("MSSQLServer").OpenSubKey("MSSQLServer").OpenSubKey("CurrentVersion");

However, this one does not:

var subKey3 = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("MSSQLServer").OpenSubKey("Setup");

“Setup” looks to be the same type of value as the other keys. Any thoughts why this command returns null?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:39:54+00:00Added an answer on June 5, 2026 at 5:39 am

    Your application is 32-bit and that is a 64-bit registry key. 32-bit and 64-bit applications have different views of the registry. In regedit the key you are getting in code is at HKLM\Software\Wow6432Node\MSSQLServer, not HKLM\Software\MSSQLServer (in your picture).

    Unfortunately, the managed API for accessing registry keys does not allow a 32-bit application to get a 64-bit view of the registry.

    There are two options: Change your application to target AnyCPU or x64 or P/Invoke the unmanaged API. This has an example of how to do the P/Invoke and the MSDN documentation.

    BTW, you can pass a path to the OpenSubKey method instead of chaining them together like that.

    Update: I was not quite correct above. As of .NET 4, the OpenBaseKey method (MSDN) can be used to get a 64-bit view in a 32-bit application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Machine does not have full sql server installed. but following distributable packages are installed
I have installed SQL Server 2005 three times now on the same box. I
I have installed SQL Server 2008 R2 Express on Windows 7. When I run
I have just installed SQL Server 2008 including Reporting Services on Windows Server 2003.
I have both SQL Server 2005 and Visual Studio 2008 installed and think it
I have 2 PCs, each one of them has SQL Server 2008 installed on
I have a server where I installed SQL Server 2008 and after I applied
I have two servers where I installed SQL Server 2008 Production: RAID 1 on
I have VS 2008 and SQL Server 2005 Developer edition installed on my desktop.
We have two virtual machines on a server. We have Sql server installed on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.