Page 1 of 1 1
Topic Options
#40582 - 2003-05-21 01:14 PM Batch file relating to Terminal Services
Julian Offline
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
#40583 - 2003-05-21 01:29 PM Re: Batch file relating to Terminal Services
Chris Meyer Offline
Fresh Scripter

Registered: 2003-04-16
Posts: 18
Loc: Mozambique
Hi Ju,

I see that you don't need any assistance with KIX but just in case...here is what I use to determine Terminal Server OS during Kix logon:

code:
 
If (@productsuite = "18") goto TERMSERVER
Return
:TERMSERVER

Cheers
Chris
_________________________
Chris Meyer <img border=0 title= alt=[Razz] src=tongue.gif /]

Top
#40584 - 2003-05-21 02:23 PM Re: Batch file relating to Terminal Services
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I think the way to do this is to set a unique environment var on all your Terminal Servers and then act on it in your batch file. That is the methodology we use.
code:
REM ****** START CITRIX GENERAL SCRIPT ********
IF DEFINED CitrixSvrDomain GOTO CITRIX
GOTO CITRIXEND
:CITRIX
bla bla bla

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#40585 - 2003-05-21 02:40 PM Re: Batch file relating to Terminal Services
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#40586 - 2003-05-21 02:48 PM Re: Batch file relating to Terminal Services
Richard H. Administrator Offline
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 Offline
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 Offline
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 Offline
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 ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#40590 - 2003-05-21 06:01 PM Re: Batch file relating to Terminal Services
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
And please read Use of %0\..\ to launch KiX
_________________________
There are two types of vessels, submarines and targets.

Top
#40591 - 2003-05-21 06:06 PM Re: Batch file relating to Terminal Services
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Updated the FAQ with -

MS-Tech Article findings- 318689

Thanks.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#40592 - 2003-05-22 01:26 PM Re: Batch file relating to Terminal Services
Julian Offline
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
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1110 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.059 seconds in which 0.012 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org