I am trying to determine the OS version in a .NET application that already uses System.Environment.OSVersion to successfully determine the version for all versions of Windows prior to Windows 8.1.
However, when you call System.Environment.OSVersion in a .NET application in Windows 10, the returned version of Microsoft Windows NT 6.2.9200.0 (this is exactly the same output as in Windows 8.1). However, when I call [System.Environment]::OSVersion via PowerShell, the output gives me Microsoft Windows NT 10.0.10240.0 .
I got the impression that PowerShell uses .NET under the hood and expects both calls to return exactly the same result. Why is there a mismatch in the output and, more importantly, how can I determine if my application is running on Windows 10?
alimbada
source share