I am writing a small utility that reports on the capabilities of the system. One of them is the highest shader model supported by the installed graphics card, and I am currently detecting it using Direct3D 9.0c features and checking the VertexShaderVersion and PixelShaderVersion structure of D3DCAPS9 .
HRESULT hrDCaps = poD3D9->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &oCaps); if (!FAILED(hrDCaps)) { // Pixel and vertex shader model versions. Use the minimum number of each for "the" shader model version const int iVertexShaderModel = D3DSHADER_VERSION_MAJOR(oCaps.VertexShaderVersion); const int iPixelShaderModel = D3DSHADER_VERSION_MAJOR(oCaps.PixelShaderVersion);
However, both of these values return shader model 3 even for cards supporting higher models. This is what the GPU-Z returns for the same card, for example:

This question indicates that DX9 will never report more than SM3, even on cards supporting a higher model, but does not actually mention how to solve it.
How to get the shader model supported by the installed card? That is, the capabilities of the card, not the installed capabilities of the DirectX driver.
The utility should work in Windows 2000 and higher and work with systems in which a graphics card and even DirectX are not installed. I am currently dynamically loading DX9, so on these systems the check gracefully fails (this is normal). But I'm looking for a similar solution: something that will still work on all systems and work correctly (detect the SM version) on most systems.
Change - purpose: I do not use this code to dynamically change program functions, i.e. shader selection. I use it to communicate hardware capabilities as a “ping” to the server, which is used so that we have a good idea of the typical equipment that our customers use, which can inform about future product solutions. (For example: how many clients has SM4 or higher? How many of them use a 64-bit OS? And so on) That's why either (a) gracefully fails, so we know that it failed, or (b) getting accurate shader model number - two preferred modes.
Edit - answers so far:. The answer provided by SigTerm suggests creating a DirectX 11, 10.1, 10, and 9.0c instance in order and based on the specified shader model on which the instance was created without failures (model 5, 4.1, 4 and DXCAPS shader in that order.) If possible, I would appreciate a sample DX11 code and 10 ways to do this.
This may not be a reliable solution. For example, I am running Windows on a VMWare Fusion virtual machine on OSX. Fusion drivers report DX11 to DxDiag, but I know from the Fusion specifications that it only supports DX9.0c and shader model 3 . However, with this exception, this method seems to be the best way so far.