[THIN] Connect to a Citrix Server from the Command Line

  • From: Jim Kenzig <jimkenz@xxxxxxxxxxxxxx>
  • To: thin@xxxxxxxxxxxxx
  • Date: Mon, 28 Oct 2002 13:30:27 -0500

This is from....
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=26646

[Reader to Reader]
Connect to a Citrix Server from the Command Line

  Advertisement


Readers
InstantDoc #26646
November 2002


A frustration for consultants who work on different servers every day is
that almost all GUI connection tools, including the standard Citrix client,
require housekeeping before you can connect to a server. To work around this
problem, you can create a connection file that contains all the relevant
data. My solution is to use a batch file that takes the target Citrix
server's address as an argument, as well as the connection's desired
resolution. The batch file, which Listing 1 shows, then generates an ICA
file (i.e., a plain text file with information about the connection) and
launches the ICA client to connect to the Citrix server.

Running this batch file leaves two files on your system: ica.log and
tmp.ica, both in your global \%TEMP% folder. If you have the Sleep command
on your system, you can uncomment the lines rem sleep 2 and rem del
%icafile% to automatically delete the temporary ICA file.

?Alex Angelopoulos
alexangelopoulos@xxxxxxxxxxx

LISTING 1: ICA.cmd

@echo off
rem created by Alex K. Angelopoulos
rem April 2001
rem alexangelopoulos@xxxxxxxxxxx

rem Takes two arguments: IP address and (optional) resolution

rem Go to Help section if traditional switch or no arguments issued

if {"%1"} == {""} goto :HELPTEXT
if {%1} == {^/^/} goto :HELPTEXT
if {%1} == {^/?} goto :HELPTEXT
if {%1} == {^/h} goto :HELPTEXT
if {%1} == {-h} goto :HELPTEXT

if {%2} == {} (
set width=640 & set height=480 & goto makefile
)else if {%2} == {0} (
set width=320 & set height=240 & goto makefile
)else if {%2} == {1} (
set width=512 & set height=384 & goto makefile
)else if {%2} == {2} (
set width=640 & set height=480 & goto makefile
)else if {%2} == {3} (
set width=800 & set height=600 & goto makefile
)else if {%2} == {4} (
set width=1024 & set height=768 & goto makefile
)else if {%2} == {5} (
set width=1152 & set height=864 & goto makefile
)else goto HELPTEXT

:makefile
pushd %temp%
set icafile=tmp.ica
@echo [WFClient] > %icafile%
@echo Version = 2 >> %icafile%
@echo [ApplicationServers] >> %icafile%
@echo ; Name below will appear in the title bar of ICA client >> %icafile%
@echo ; It MUST be identical to the connectoid header >> %icafile%
@echo %1 = >> %icafile%
@echo ; connectoid header is in brackets below; MUST match friendly name
above >> %icafile%
@echo [%1] >> %icafile%
@echo ; Server IP address or DNS name goes here >> %icafile%
@echo Address = %1 >> %icafile%
@echo TransportDriver = TCP/IP >> %icafile%
@echo Username = >> %icafile%
@echo Compress = On >> %icafile%
@echo PersistentCacheEnabled = On >> %icafile%
@echo InitialProgram = >> %icafile%
@echo WinStationDriver = ICA 3.0 >> %icafile%
@echo DesiredColor = 0 >> %icafile%
@echo DesiredHRES = %width% >> %icafile%
@echo DesiredVRES = %height% >> %icafile%

rem Launch and log
rem Remaining files in TEMP will be ica.log and tmp.ica
start %icafile%
rem sleep 2
rem del %icafile%
goto eof

:HELPTEXT
@echo.
@echo Syntax: %0 ^<hostname^> [ ^| 0 ^| 1 ^| 2 ^| 3 ^| 4]
@echo where the integer sets resolution:
@echo 0 - 320x240
@echo 1 - 512x384
@echo 2 - 640x480
@echo 3 - 800x600
@echo 4 - 1024x768
@echo 5 - 1152x864
@echo.
@echo If no size chosen, defaults to 640x480
@echo.

:eof






**********************************************
This weeks Sponsor NetX Inc Thin Client
NetX Develops XP and NT Embedded 
Thin Client Solutions, Easy to Configure, 
Extremely Secure, and Remotely Managed.
Check out our recently updated website at
http://www.netxinc.com
***********************************************
Visit Jim Kenzig of thethin.net at the
Emergent Online Booth #26 at Citrix Iforum 2002!
Register now at:
http://www.citrixiforum.com/registerNow.html
*********************************************** 
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm

Other related posts:

  • » [THIN] Connect to a Citrix Server from the Command Line