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:

<b>Edition</b> is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain:
        <b>N</b> - If R2 is <b>NOT</b> installed.
        <b>0</b> - If Windows Storage Server 2003 R2, Express Edition is installed.
        <b>1</b> - If Windows Storage Server 2003 R2, Workgroup Edition is installed.
        <b>2</b> - If Windows Server 2003 R2, Standard Edition or Windows Storage Server 2003 R2, Standard Edition is installed.
        <b>3</b> - If Windows Server 2003 R2, Enterprise Edition or Windows Storage Server 2003 R2, Enterprise Edition is installed.
        <b>4</b> - If Windows Server 2003 R2 Datacenter Edition is installed.

<b>Comp</b>    is an optional computer name. If omitted, the local computer is used.
W2K3R2Edition.bat contains:
@echo off
setlocal ENABLEDELAYEDEXPANSION
set Edition=N
if \{%1\}<h1><a name="_goto_err1_if_2_">\{\} goto err1
if \{%2\}</a></h1>\{\} 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=%