How can I get the Windows version number from .NET?

220 Views Asked by At

I'm using a virtualized web server and I don't remember whether it's running Windows Server 2000 or 2003. How can I tell which?

Ask the ISP, course, which I did. The question, then, is somewhat academic. Is there any way to tell this from .NET?

I access the machine through Plesk, which is designed to shield you from this kind of arcana.

Why do I want to know this? Because I'm getting ready to install a product that is supported on 2003 but not 2000. (I know this doesn't mean it won't run.)

2

There are 2 best solutions below

1
On BEST ANSWER

You can retrieve this from System.Environment.OSVersion.

1
On

When retrieving version information from System.Environment.OSVersion remember that checking file versions is surprisingly hard.