Determining if the program is running on Windows Server

前端 未结 5 374
北恋
北恋 2020-12-03 04:06

I would like to determine if my program is running on a version of Windows Server. Apparently, System.Environment does not contain information about the fact th

5条回答
  •  Happy的楠姐
    2020-12-03 04:23

    You can p/invoke the following Win32 functions:

    GetProductInfo for Vista/Windows Server 2008+
    GetVersionEx for Windows 2000+

    BJ Rollison has a good post and sample code about this on his blog.

提交回复
热议问题