Skip navigation

JSI Tip 10178. How can I determine the version of Windows Server 2003 R2 that is running on a computer?

Windows Server 2003 R2 is available in the following editions:

Windows Server 2003 R2 Datacenter Edition (x64 and x86)  
Windows Server 2003 R2 Enterprise Edition (x64 and x86)  
Windows Server 2003 R2 Standard Edition (x64 and x86)
Windows Storage Server 2003 R2 is available in the following editions:
Windows Storage Server 2003 R2, Enterprise Edition (x64 and x86) 
Windows Storage Server 2003 R2, Express Edition (x64 and x86) 
Windows Storage Server 2003 R2, Standard Edition (x64 and x86) 
Windows Storage Server 2003 R2, Workgroup Edition (x64 and x86)
I have scripted W2K3R2Edition.bat to determine the edition of Windows Server 2003 R2 or Windows Storage Server 2003 R2 that is running on a computer.

The syntax for using W2K3R2Edition.bat is:

\[Call\] W2K3R2Edition Edition \[Comp\]

Where:

Edition is a call directed environment variable that will contain:
        N - If R2 is NOT installed.
        0 - If Windows Storage Server 2003 R2, Express Edition is installed.
        1 - If Windows Storage Server 2003 R2, Workgroup Edition is installed. 
        2 - If Windows Server 2003 R2, Standard Edition or Windows Storage Server 2003 R2, Standard Edition is installed.
        3 - If Windows Server 2003 R2, Enterprise Edition or Windows Storage Server 2003 R2, Enterprise Edition is installed.
        4 - If Windows Server 2003 R2 Datacenter Edition is installed.

Comp    is an optional computer name. If omitted, the local computer is used.
W2K3R2Edition.bat contains:
@echo off
setlocal ENABLEDELAYEDEXPANSION
set Edition=N
if \{%1\}

\{\} goto err1 if \{%2\}

\{\} goto get set comp=%2 set comp=%comp:"=% set comp=\\%comp:\=%if not exist %comp%c$ goto :err2 :get set key=%comp%HKLM\SOFTWARE\Microsoft\ServerAppliance call :getedn>nul 2>&1 endlocal&set %1=%Edition% endlocal goto :EOF :err1 @echo Syntax: W2K3R2Edition Edition \[Comp\] endlocal goto :EOF :err2 @echo Syntax: W2K3R2Edition Edition \[Comp\] - %2 NOT found. endlocal goto :EOF :getedn for /f "tokens=1,3" %%a in ('reg query %key% /V Edition^|find /i "Edition"') do ( set Edition=%%b ) set Edition=%Edition:0x=%



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish