#40582 - 2003-05-21 01:14 PM
Batch file relating to Terminal Services
|
Julian
Starting to like KiXtart
Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
|
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
|
|
Top
|
|
|
|
#40585 - 2003-05-21 02:40 PM
Re: Batch file relating to Terminal Services
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Ju,
Similar to Les' response, we use -
code:
IF "%COMPUTERNAME%" == "SC01" GOTO :CITRIX IF "%COMPUTERNAME%" == "SC02" GOTO :CITRIX IF "%COMPUTERNAME%" == "SC03" GOTO :CITRIX IF "%COMPUTERNAME%" == "SC04" GOTO :CITRIX
Another way, you could look for Citrix-specific Utilities -
IF EXIST %WINDIR%\SYSTEM32\QLICENSE.EXE GOTO :CITRIX
Or QSERVER.EXE
You could look for the %CLIENTNAME% variable if it is not Citrix Session.
HTH,
Kent
|
|
Top
|
|
|
|
#40586 - 2003-05-21 02:48 PM
Re: Batch file relating to Terminal Services
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
I may be mis-understanding, but isn't this all you need: quote: IF "%SESSIONNAME%" == "" GOTO NotTS IF NOT "%SESSIONNAME%" == "Console" GOTO END :NotTS 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 blah blah ...
[ 21. May 2003, 14:50: Message edited by: Richard H. ]
|
|
Top
|
|
|
|
#40587 - 2003-05-21 02:52 PM
Re: Batch file relating to Terminal Services
|
Julian
Starting to like KiXtart
Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
|
OK! Thanks for your replies, youve given me a couple of ideas to have a play around with.
Thanks
Ju
|
|
Top
|
|
|
|
#40588 - 2003-05-21 05:39 PM
Re: Batch file relating to Terminal Services
|
Julian
Starting to like KiXtart
Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
|
Richard - I think thats the perfect solution. Very simple really. Doh!!!
Many Thanks
Ju
|
|
Top
|
|
|
|
#40589 - 2003-05-21 05:53 PM
Re: Batch file relating to Terminal Services
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Ju,
BTW,
You can simplify -
code:
for /f "Tokens=*" %%i in ('ver') DO (IF "%%i" == "Microsoft Windows XP [Version 5.1.2600]" GOTO XP)
With..
code:
VER | find "XP" > nul IF not errorlevel 1 GOTO XP
Thanks,
Kent [ 21. May 2003, 17:54: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#40591 - 2003-05-21 06:06 PM
Re: Batch file relating to Terminal Services
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Updated the FAQ with -
MS-Tech Article findings- 318689
Thanks.
Kent
|
|
Top
|
|
|
|
#40592 - 2003-05-22 01:26 PM
Re: Batch file relating to Terminal Services
|
Julian
Starting to like KiXtart
Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
|
Hello,
Thanks for all this great input. I have now amended my batch files to reflect the chnages that Richard H and kyder mentioned.
However, I have read through the KiX article that sealopard mentioned:
Use of %0\..\ to launch KiX
but cannot fathom out what changes I should make to improve repsonse time. The scripts all seem to execute fine and they have been for sometime on all platforms. If you could give me a litle hint that would be great.
Many Thanks again.
Julian
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1110 anonymous users online.
|
|
|