区分服务器操作系统和工作站 [英] distinguish between server os and workstation

查看:146
本文介绍了区分服务器操作系统和工作站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式告诉应用程序是在服务器上运行还是在工作站上运行,例如: windows 2000服务器或Windows 2000专业版

例子?


谢谢,


Dennis

How can I tell programmatically if an application is running on a server or
workstation, e.g. windows 2000 server or windows 2000 professional for
example?

Thanks,

Dennis

推荐答案

嗨Dennis,


据我所知,我们可以检查操作系统的版本为

区分它是在服务器操作系统还是工作站操作系统上。

System.Environment.OSVersion属性旨在实现此目的。请查看

以下链接获取更多信息。

http://msdn.microsoft.com/library/de...us/cpref/html/

frlrfsystemenvironmentclassosversiontopic.asp

Kevin Yu

=======

"此帖子是提供按原样没有保证,并且不授予

权利。

Hi Dennis,

As far as I know, we can check the version of the operating system to
distinguish whether it is on a server os or a workstation os.
System.Environment.OSVersion property is designed to do this. Please check
the following link for more information.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemenvironmentclassosversiontopic.asp

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


>如何以编程方式告诉应用程序是否正在运行在服务器上或
>How can I tell programmatically if an application is running on a server or
工作站,例如Windows 2000服务器或Windows 2000专业版
示例?
workstation, e.g. windows 2000 server or windows 2000 professional for
example?




使用OSVERSIONINFOEX结构调用GetVersionEx,然后检查是否

wProductType member设置了VER_NT_SERVER或VER_NT_WORKSTATION

标志。请参阅

http://support.microsoft.com/ ?kbid = 304721
http://msdn.microsoft.com/library/en...tversionex.asp


另一种方法是使用WMI,Win32_OperatingSystem类及其

ProductType属性。


Mattias


-

Mattias Sj?gren [ MVP] mattias @ mvps.org
http://www.msjogren.net/ dotnet / | http://www.dotnetinterop.com

请回复到新闻组。



Call GetVersionEx with the OSVERSIONINFOEX struct, then check whether
the wProductType member has the VER_NT_SERVER or VER_NT_WORKSTATION
flag set. See

http://support.microsoft.com/?kbid=304721
http://msdn.microsoft.com/library/en...tversionex.asp

An alternative is to use WMI, the Win32_OperatingSystem class and its
ProductType property.

Mattias

--
Mattias Sj?gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Kevin:


平台名称以及主要,次要和内部版本编号对于<​​br />
服务器和工作站。对于Windows 2000,两者都是Win32NT平台

并且两者共享相同的版本号5.0.2195。在安装的Service Pack上,部署(我认为)的内部版本号基于
。所以两者之间必须有一些

其他区别标识符?


谢谢,


Dennis
Kevin Yu [MSFT]" <,V - **** @ online.microsoft.com>在消息中写道

news:b7 ************** @ TK2MSFTNGXA01.phx.gbl ...
Kevin:

The platform name and the major, minor and build numbers are the same for
both the server and workstation. For windows 2000 both are Win32NT platforms
and both share the same version number, 5.0.2195. The build number is based
in part (I think) upon the service pack installed. So there must be some
other distinguishing identifier between the two?

Thanks,

Dennis
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:b7**************@TK2MSFTNGXA01.phx.gbl...
嗨Dennis,

据我所知,我们可以查看操作系统的版本,以区分它是在服务器操作系统还是工作站操作系统上。
System.Environment.OSVersion属性是旨在做到这一点。请查看以下链接以获取更多信息。

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemenvironmentclassosversiontopic.asp

Kevin Yu
=======
这个帖子是按原样提供的没有保证,也没有赋予
权利。
Hi Dennis,

As far as I know, we can check the version of the operating system to
distinguish whether it is on a server os or a workstation os.
System.Environment.OSVersion property is designed to do this. Please check
the following link for more information.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemenvironmentclassosversiontopic.asp

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."



这篇关于区分服务器操作系统和工作站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆