In a tip 4400, I scripted NTV.BAT to return an NTV environment variable contains the operating system version number.

I have scripted another version of NTV.BAT that does not use any add-on software.

To use the new NTV.BAT:

1. Copy this NTV.BAT to the Netlogon share (an replicas).

2. If you have any Windows 9x or Windows ME clients, you may want to implement tip 1786.

3. In your logon script:

<b>set NTV=N/A
if "%OS%"<h1><a name="_Windows_NT_call_logonserver_netlogon_NTV_BAT_b_pre_You_can_then_test_the_b_NTV_b_environment_variable_Here_is_sample_pre_if_NTV_">"Windows_NT" call %logonserver%\netlogon\NTV.BAT</a></h1></b>.
You can then test the NTV environment variable. Here is sample:
if "%NTV%""N/A" goto Win9x
if "%NTV%"<h1><a name="_4_0_goto_WNT_if_NTV_">"4.0" goto WNT
if "%NTV%"</a></h1>"5.0" goto W2K
REM  Windows XP here
NTV.BAT contains:
@echo off
set NTV=N/A
if NOT "%OS%"=="Windows_NT" goto downlev
regedit /a %TEMP%\CV.REG "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion"
@echo "CurrentVersion"=>%TEMP%\CVS.TXT
for /f "Tokens=*" %%i in ('findstr /b /g:%TEMP%\CVS.TXT %TEMP%\CV.REG') do set line="%%i"&call :parse
del /q %TEMP%\CV.REG
del /q %TEMP%\CVS.TXT
endlocal&set NTV=%NTV%
goto :EOF
set work=%line:"=%
set work=%work:CurrentVersion=%
set NTV=%work:~1,9%