WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Microsoft Client
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Need help detecting the difference between NT Server and NT Workstation

Keywords:   NT Server NT Workstation

Question:

We are using Winbatch to run our domain logon script. I need to determine if a user is logging on from workstation or server. I don't want to SMS our servers. Any ideas?

Answer:

A "server" is any machine running the "Server" service. A "Workstation" is any machine running the "Workstation" service.

Most machine commonly referred to as Workstations or servers run both services, and thus they are indistinguishable by the wntServerList function.

If you want the "role" the machine is set up for, a "Server" role or a "Workstation" role, you have to peer into the machine's registry (do you have security privileges?), e.g.,

----------------------------------------------------------

From Microsoft Database:

Determining System Version from a Win32-based Application

Last reviewed: May 2, 1996
Article ID: Q92395

In order to distinguish between Windows NT Workstation and Windows NT Server, use the registry API to query the following:

        \HKEY_LOCAL_MACHINE\SYSTEM
        \CurrentControlSet
        \Control
        \ProductOptions

The result will be one of the following:
        WINNT      Windows NT Workstation is running.
        SERVERNT   Windows NT Server (3.5 or later) is running.
        LANMANNT   Windows NT Advanced Server (3.1) is running.

----------------------------------------------------------

WIL Sample code

ver = WinVersion(4)
if ver == 4  ;if NT
   prodstring = ""
   prodoptions=RegQueryValue(@RegMachine,"System\CurrentControlSet\Control\ProductOptions[ProductType]")
	if StrUpper(prodoptions) == "WINNT"
	   prodstring = "Windows NT Workstation is running."
	Endif
	if StrUpper(prodoptions) == "SERVERNT"
	   prodstring = "Windows NT Server (3.5 or later) is running."
	Endif
	if StrUpper(prodoptions) == "LANMANNT"
	   prodstring = "Windows NT Advanced Server (3.1) is running."
	Endif
	Message("Product Option", prodstring)
Endif

Article ID:   W13531
Filename:   Distinguish between NT 4 Server and Workstation.txt
File Created: 2002:12:17:14:45:04
Last Updated: 2002:12:17:14:45:04