How to Determine the Microsoft Windows NT Product Type with a Batch File
ID: Q245129
|
The information in this article applies to:
-
Microsoft Windows NT Server version 4.0
-
Microsoft Windows NT Workstation version 4.0
SUMMARY
This article describes how to use a batch file to determine which type of Microsoft Windows NT installation you are currently running on your computer. The Windows NT installation types include server, workstation, and domain controller.
MORE INFORMATION
To determine which type of Windows NT installation you are running, follow these steps:
NOTE: You must have the Reg.exe tool installed on your computer for these steps to work. The Reg.exe tool is included with the Windows NT 4.0 Resource Kit.
- Copy the following batch file into Microsoft Word for Windows or a
word-processing program that inserts the proper ASCII characters
for the TAB key.
NOTE: Do not use Microsoft WordPad or Microsoft Notepad.
Using the TAB key (or tab) in Notepad does not insert the
proper ASCII characters. Also, if you write the batch file in
Microsoft Word, and then view it in Notepad, the tab appears as a
space. Having the proper ASCII characters for the tab is
imperative because the output from the Reg.exe tool uses tabs as
the delimiter and the 'for' command that is used to parse the
output only recognizes tabs as the delimiter.
@echo off
if not (%OS%)==(Windows_NT) goto NotNT
REM Next Line wrapped by text editor for readability, it should all be on one line
for /F "delims= tokens=3" %%i
IN ('reg query hklm\system\currentcontrolset\control\ProductOptions\ProductType')
DO set product_type=%%i
REM End single line
if "%product_type%"=="" goto Undetermined
if "%product_type%"=="WinNT" goto Workstation
if "%product_type%"=="ServerNT" goto Server
if "%product_type%"=="LanmanNT" goto DomainController
:Undetermined
echo Unable to determine Windows NT Product Type, check the following
echo registry key for product type
echo.
echo hklm\system\currentcontrolset\control\ProductOptions\ProductType
echo.
echo Expected values
echo.
echo ProductType Product
echo ----------------------------------------------------
echo WinNT Windows NT Workstation is running
echo ServerNT Windows NT Server is running
echo LanmanNT Windows NT Domain controller
echo.
goto end
:DomainController
echo Product type is NT Domain Controller
goto end
:Server
echo Product type is NT Server
goto end
:Workstation
echo Product type is NT Workstation
goto end
:NotNT
echo Current Operating System is not Windows NT
:end
- Save the batch file as a text-only file.
- In Windows NT Explorer, locate the folder in which you saved the
text file, and then change the extension of the file from .txt to
.bat.
- To run the batch file at the Command Prompt, type the full path to
the location of the file (including the file name), and then press
ENTER.
You can also write a program by using the C++ programming language to determine the type of Windows NT installation you are running on your computer. For a sample of such a program, please see the following article in the Microsoft Knowledge Base:
Q124305 Which Windows NT (Server or Workstation) Is Running?
Additional query words:
Keywords :
Version : winnt:4.0
Platform : winnt
Issue type : kbinfo
|