supportedOS ID for windows 11

Paul Gafa 1 Reputation point
2021-07-06T14:10:57.13+00:00

https://learn.microsoft.com/en-us/windows/win32/sysinfo/targeting-your-application-at-windows-8-1

How can I detect windows 11 from a desktop application. I found no ID for it.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,389 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Jenny Feng 14,081 Reputation points
    2021-07-07T02:00:37.093+00:00

    @Paul Gafa
    Hi,
    Since Windows 11 is newly released, there seems to be no relevant information at the moment.

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread


  2. Castorix31 82,036 Reputation points
    2021-07-21T07:55:55.307+00:00

    I don't have Windows 11, but maybe you can try the methods used on Windows 10 :

    • By reading values at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
      (MS apps like Winver do that)
    • With RtlGetVersion :
        HMODULE hDll = LoadLibrary(TEXT("Ntdll.dll"));
      typedef NTSTATUS(CALLBACK* RTLGETVERSION) (PRTL_OSVERSIONINFOW lpVersionInformation);
      RTLGETVERSION pRtlGetVersion;
      pRtlGetVersion = (RTLGETVERSION)GetProcAddress(hDll, "RtlGetVersion");
      if (pRtlGetVersion)
      {
          RTL_OSVERSIONINFOW ovi = { 0 };
          ovi.dwOSVersionInfoSize = sizeof(ovi);
          NTSTATUS ntStatus = pRtlGetVersion(&ovi);
          if (ntStatus == 0)
          {
              TCHAR wsBuffer[512];
              wsprintf(wsBuffer, TEXT("Major Version : %d - Minor Version : %d - Build Number : %d\r\n"), ovi.dwMajorVersion, ovi.dwMinorVersion, ovi.dwBuildNumber);
              OutputDebugString(wsBuffer);
          }
      }
      

  3. triendl.kj 11 Reputation points
    2021-10-06T08:38:41.04+00:00

    It might be worth giving sysinternal's procmon utility a try, and see e.g. which registry values winver.exe reads.


  4. Jared Plaisted 1 Reputation point
    2021-11-10T03:52:13.58+00:00

    It would be good to have official guidance from MS on the correct approach.
    In the mean time I've found the following works for what I need.

    Querying the WMI Win32_OperatingSystem for the "Caption" property which reads "Microsoft Windows 11 Pro" on my test machine.

    For a quick test using powershell you can use this command.
    get-wmiobject win32_operatingsystem | select Caption

    Then combining the above with details like "ReleaseId" or "DisplayVersion" from the registry.
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

    0 comments No comments