JSI Tip 4131. How can I make a quick connection to a Citrix server without generating an ICA file or entry?


Alex K. Angelopoulos submitted the following:

"This script allows you to make a quick connection to a Citrix server without generating an ICA file or entry. The syntax, assuming you use the name ica.cmd for the file, is:

ica <ip-address or dns name> \[<resolution>\]

Where \[<resolution>\] is an optional integer in the range 0-5 which controls the resolution of the resulting ICA connection.

DEPENDENCIES

-Citrix client already installed (tested using version 6.01.963)
-sleep command (used on line 61 to allow deletion of tmp.ica file after launch)
-OS Compatibility: tested on NT4 Server SP6a,Win2K Pro SP1 and SP2,WinXP Pro RC2

OPTIONAL
-If you uncomment line 56, the date, time, and server you attempt to contact will be appended to %TEMP%\ica.log
-If the sleep command is unavailable, comment out lines 54 and 55 ( sleep 2 and  del %icafile%). 
 If you do this, the tmp.ica file will not be automatically deleted from your %TEMP% folder."

ICA.cmd contains:

@echo off
rem created by Alex K. Angelopoulos
rem April 2001
rem a l e x a n g e l o p o u l o s @ h o t m a i l.com
rem Takes 2 arguments, IP address and (optional) resolution integer
(0-320,1-512,2-640,3-800,4-1024,5-1152)
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% sleep 2 del %icafile% rem echo %DATE% %TIME% %1 >>ica.log popd goto eof :HELPTEXT @echo. @echo Syntax: %0 ^ \[ ^| 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


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish