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:

set NTV=N/A                              if "%OS%"

"Windows_NT" call %logonserver%\netlogon\NTV.BAT

.
You can then test the NTV environment variable. Here is sample:
if "%NTV%""N/A" goto Win9x                              if "%NTV%"

"4.0" goto WNT if "%NTV%"

"5.0" goto W2K REM Windows XP here
NTV.BAT contains:
@echo off                              setlocal                              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                              :downlev                              endlocal&set NTV=%NTV%                              goto :EOF                              :parse                              set work=%line:"=%                              set work=%work:CurrentVersion=%                              set NTV=%work:~1,9%