Hello,

Im hoping you can help with this query I have. I know its not a forum for posting questions relating to batch files but I have come across queries before so im hoping you can help.

Below is the initial batch file used to call kix which was kindly given to me by somebody on this board.

code:
 IF NOT "%OS%" == "Windows_NT" GOTO WIN9X
for /f "Tokens=*" %%i in ('ver') DO (IF "%%i" == "Microsoft Windows XP [Version 5.1.2600]" GOTO XP)
IF NOT "%ALLUSERSPROFILE%" == "" GOTO WIN2K
IF "%OS%" == "Windows_NT" GOTO NT4
GOTO END

:XP
REM **** Found Windows XP ****
ECHO Y| XCOPY %0\..\KIX\KIX32.EXE %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
ECHO Y| XCOPY %0\..\KIX\IPOFFICE.INI %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
ECHO Y| XCOPY %0\..\Utils\wclscut.exe %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
ECHO Y| XCOPY %0\..\Utils\wclfxini.exe %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
REM Loading Logon Script, Please Wait...
%WINDIR%\SYSTEM32\KIX32.EXE %0\..\kix\loginset.kix
CLS
GOTO END

:WIN2K
REM **** Found Windows 2000 ****
ECHO Y| XCOPY %0\..\KIX\KIX32.EXE %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
ECHO Y| XCOPY %0\..\KIX\IPOFFICE.INI %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
ECHO Y| XCOPY %0\..\Utils\wclscut.exe %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
ECHO Y| XCOPY %0\..\Utils\wclfxini.exe %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
REM Loading Logon Script, Please Wait...
%WINDIR%\SYSTEM32\KIX32.EXE %0\..\kix\loginset.kix
CLS
GOTO END

:NT4
REM **** Found WinNT 4.0 ****
XCOPY %0\..\KIX\KIX32.EXE %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
XCOPY %0\..\KIX\IPOFFICE.INI %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
XCOPY %0\..\Utils\wclscut.exe %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
XCOPY %0\..\Utils\wclfxini.exe %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
REM Loading Logon Script, Please Wait...
%WINDIR%\SYSTEM32\KIX32.EXE %0\..\kix\loginset.kix
CLS
GOTO END

:WIN9X
REM **** Found Win9X ****
%windir%\command\XCOPY %0\..\KIX\KIX32.EXE %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\KIX\KX16.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\KIX\KX32.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\KIX\KX95.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\KIX\KIX32.EXE %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\KIX\IPOFFICE.INI %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\Utils\wclscut.exe %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\Utils\winset.exe %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\Utils\wclfxini.exe %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
REM Loading Logon Script, Please Wait...
%windir%\system\kix32.exe %0\..\kix\loginset.kix
CLS
GOTO END

:END

REM Start Microsoft SMS Client Install ***************
REM SMS Build 1493
Call \\%server%\netlogon\SMSLS.bat
REM End Microsoft SMS Client Install **************

EXIT

This works an obsolute treat for the systems we are currently using, however we are now going to be using terminal servers for some of our departments who want to work remotely.

We have a mix of clients in our company from 95, 98, NT4.0 WS/Server, Win2K Server and WinXP. I'd like to be able to detect if a user is logging on through a TS or client. I added the line below thinking it would work:

code:
 IF NOT "%SESSIONNAME%" == "Console" GOTO END 

It did for all the XP clients and poepl logging onto TS but NT4.0 clients don't have the %SESSIONNAME% setting so immediately went to the end and didnt run any scripts.

I know that this can be done with KiX but i'd like to be able to not have to launch kix. I dont fancy giving them different logons for the TS or placing a unique file on al the TS. Im hoping for a better solution all round.

Any ideas, suggestions would be greatly appreciated.

Many Thanks

Ju