Yes, https://learn.microsoft.com/en-us/windows-server/get-started/windows-server-release-info
but there are older versions than 2016 :
https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello experts,
To detect Windows Server 2016 and onward, I use this code, my question is that am I using the correct build numbers to distinguish?
Thanks :)
If OSVERSIONINFOEX.dwMajorVersion = 10 Then
If OSVERSIONINFOEX.wProductType = VER_NT_WORKSTATION Then
If OSVERSIONINFOEX.dwBuildNumber >= 21337 Then
Return "Windows 11"
Else
Return "Windows 10"
End If
Else
Select Case OSVERSIONINFOEX.dwBuildNumber
Case Is <= 14393
Return "Windows Server 2016"
Case Is <= 17763
Return "Windows Server 2019"
Case Is <= 20348
Return "Windows Server 2022"
Case Is <= 26212
Return "Windows Server 2025"
Case Else
Return "Windows Server ????"
End Select
End If
End If
Yes, https://learn.microsoft.com/en-us/windows-server/get-started/windows-server-release-info
but there are older versions than 2016 :
https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
Hi @StewartBW ,
Your approach for distinguishing Windows Server versions based on dwBuildNumber
is mostly correct.
The latest preview is Windows Server Preview Build 26252 and the Windows Server 2025's build number not yet been announced.
If OSVERSIONINFOEX.dwMajorVersion = 10 Then
If OSVERSIONINFOEX.wProductType = VER_NT_WORKSTATION Then
If OSVERSIONINFOEX.dwBuildNumber >= 21337 Then
Return "Windows 11"
Else
Return "Windows 10"
End If
Else
Select Case OSVERSIONINFOEX.dwBuildNumber
Case <= 14393
Return "Windows Server 2016"
Case 14394 To 17763
Return "Windows Server 2019"
Case 17764 To 20348
Return "Windows Server 2022"
Case Else
Return "Windows Server (Unknown Version)"
End Select
End If
End If
Best Regards.
Jiachen Li
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 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.