473,396 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

distinguish between server os and workstation

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
Nov 17 '05 #1
13 5812
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."

Nov 17 '05 #2
>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?


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.
Nov 17 '05 #3
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...
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."

Nov 17 '05 #4
Thanks Mattias,

Is there any way this can be done without using InteropServices?

Thanks,

Dennis

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
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?


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.

Nov 17 '05 #5
Mattias:

I see now that WMI is a managed class. I am trying to figure out how to use
it.

Thanks for the info,

Dennis
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
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?


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.

Nov 17 '05 #6
>Is there any way this can be done without using InteropServices?

Yes, as I said you can use WMI (System.Management).


Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 17 '05 #7
Mattias:

from testing and the documentation, it seems that WinNT and Win2K does not
support the ProductType property.

Does this square with you understanding of this class?

If so, do you know of some other way to use someting in WMI to destinguish
server from workstation?

Thanks,

Dennis
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:OR**************@TK2MSFTNGP09.phx.gbl...
Is there any way this can be done without using InteropServices?


Yes, as I said you can use WMI (System.Management).


Mattias

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

Nov 17 '05 #8
Hi Dennis,

After checking the OSVersion, we make sure that this is a Windows 2000 OS,
we can use a registry key to distinguish the server/pro version of Windows
2000.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\ProductOptions\ProductTy
pe

WinNT stands for Pro, while ServerNT stands for Server.

HTH.

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

Nov 17 '05 #9
Hi Dennis,

Please also check the following link:

http://blogs.msdn.com/ejarvi/archive...08/151162.aspx

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

Nov 17 '05 #10
from testing and the documentation, it seems that WinNT and Win2K does not
support the ProductType property.


You're right, sorry I missed that.

The only other option I know, if you don't want to call GetVersionEx,
is to look directly in the Registry. See

http://www.microsoft.com/resources/d...ntry/29625.asp

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 17 '05 #11
Thank you very much!

Dennsi
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:u8**************@TK2MSFTNGP10.phx.gbl...
from testing and the documentation, it seems that WinNT and Win2K does not
support the ProductType property.


You're right, sorry I missed that.

The only other option I know, if you don't want to call GetVersionEx,
is to look directly in the Registry. See

http://www.microsoft.com/resources/d...ntry/29625.asp

Mattias

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

Nov 17 '05 #12
Thnak Keven, that was very helpful,

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

Please also check the following link:

http://blogs.msdn.com/ejarvi/archive...08/151162.aspx

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

Nov 17 '05 #13
You're welcome, Dennis.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

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

Nov 17 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: ThunderMusic | last post by:
Hi, How can I get if the Windows running is a server version? Is there a property somewhere that can tell me if the Windows version is a server edition (including server, advanced server, web...
10
by: Zeng | last post by:
I just realized that there are 2 modes for garbage collection modes: server gs and workstation gs. Would someone know how I can go about changing the mode for my web application written in C#? I...
10
by: Roy | last post by:
Judging from the sheer number of posts on this topic, I'm sensing this is a fairly common problem. Only problem is, I've tried just about every recommendation in all the posts I've found thus far...
3
by: Ken Varn | last post by:
In looking into Web Services, I noticed that they can maintain Session variables. How does a web service distinguish different sessions? Does this occur when the client creates an instance of the...
1
by: lecnac | last post by:
Here's some details: Server and workstation both in the same workgroup Logged into server as local Administrator Logged into workstation as a local user that is only in the Users group The...
1
by: lecnac | last post by:
Sorry for the repost. I must have done something wrong when I tried to post my reply (I can't seem to find it). Anyway, I'd really appreciate any help that anyone could provide. My issue is...
1
by: kito | last post by:
Hi, I have a problem, when I want to access to my SQL Server Express database from my ASP.NET application. My workstation ID is KITOLAP-HP My username is user01 Now I built the following...
1
by: gnusmsa | last post by:
ASP.NET 2.0 (C#) application Using Windows authentication and impersonation Windows Server 2003 (IIS6) Server is a member server on a domain Logged into server as a domain user that is in the...
5
by: lmttag | last post by:
ASP.NET 2.0 (C#) application Intranet application (not on the Internet) Using Windows authentication and impersonation Windows Server 2003 (IIS6) Server is a member server on a domain Logged...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.