Most GUI remote control/remote computing applications are designed with the expectation that a user will typically wish to make recurring connections to a small set of hosts.
Although generally true, it is NOT the case with consulting staff. Quite often, the real situation is a need to connect arbitrarily and quickly to various hosts for assessment or troubleshooting, and then possibly not go anywhere near that particular host for weeks or months.
In this situation, the most rapid (and cleanest method, since it leaves no litter of dormant connectoids) is to specify a server via IP or DNS name from the command line. As of this writing, there are tricks for doing this with tools such as pcAnywhere and Windows Terminal Services; the Citrix ICA client, however, has no such native capability.
The script below helps fill this gap by allowing a user to simply type:
ica <hostname-or-ip-address>
from the command line and connect to the specified server.
Windows NT 4 SP6a; Windows 2000 (Professional SP2, Server SP2); Windows XP Professional (RC2)
Recent Citrix client software already installed.
ica <host> [ 0 | 1 | 2 | 3 | 4 | 5 ]
The specification of a number in the 0...5 range is optional but will allow you to control the size of the window opened to the remote host; option details are available for simply entering ica /? at a command prompt. The default size is 640x480.
Generates file TMP.ICA in the %TEMP% folder based on data passed via the command line, then uses this to launch the connection.
1 |
@echo off | |
2 | rem created by Alex K. Angelopoulos | |
3 | rem April 2001 | |
4 | rem e m a i l a d d r e s s i s winxp(at)techie(dot)com | |
5 | ||
6 | rem Takes 2 arguments, IP address and (optional) resolution, 0-320,1-512,2-640,3-800,4-1024,5-1152 | |
7 | ||
8 | ||
9 | rem Go to Help section if "traditional" switch or no arguments issued | |
10 | ||
11 | if {"%1"} == {""} goto :HELPTEXT | |
12 | if {%1} == {^/^/} goto :HELPTEXT | |
13 | if {%1} == {^/?} goto :HELPTEXT | |
14 | if {%1} == {^/h} goto :HELPTEXT | |
15 | if {%1} == {-h} goto :HELPTEXT | |
16 | ||
17 | if {%2} == {} ( | |
18 | set width=640 & set height=480 & goto makefile | |
19 | )else if {%2} == {0} ( | |
20 | set width=320 & set height=240 & goto makefile | |
21 | )else if {%2} == {1} ( | |
22 | set width=512 & set height=384 & goto makefile | |
23 | )else if {%2} == {2} ( | |
24 | set width=640 & set height=480 & goto makefile | |
25 | )else if {%2} == {3} ( | |
26 | set width=800 & set height=600 & goto makefile | |
27 | )else if {%2} == {4} ( | |
28 | set width=1024 & set height=768 & goto makefile | |
29 | )else if {%2} == {5} ( | |
30 | set width=1152 & set height=864 & goto makefile | |
31 | )else goto HELPTEXT | |
32 | ||
33 | ||
34 | :makefile | |
35 | pushd %temp% | |
36 | set icafile=tmp.ica | |
37 | @echo [WFClient] > %icafile% | |
38 | @echo Version = 2 >> %icafile% | |
39 | @echo [ApplicationServers] >> %icafile% | |
40 | @echo ; Name below will appear in the title bar of ICA client >> %icafile% | |
41 | @echo ; It MUST be identical to the connectoid header >> %icafile% | |
42 | @echo %1 = >> %icafile% | |
43 | @echo ; connectoid header is in brackets below; MUST match friendly name above >> %icafile% | |
44 | @echo [%1] >> %icafile% | |
45 | @echo ; Server IP address or DNS name goes here >> %icafile% | |
46 | @echo Address = %1 >> %icafile% | |
47 | @echo TransportDriver = TCP/IP >> %icafile% | |
48 | @echo Username = >> %icafile% | |
49 | @echo Compress = On >> %icafile% | |
50 | @echo PersistentCacheEnabled = On >> %icafile% | |
51 | @echo InitialProgram = >> %icafile% | |
52 | @echo WinStationDriver = ICA 3.0 >> %icafile% | |
53 | @echo DesiredColor = 0 >> %icafile% | |
54 | @echo DesiredHRES = %width% >> %icafile% | |
55 | @echo DesiredVRES = %height% >> %icafile% | |
56 | ||
57 | ||
58 | rem Launch and log | |
59 | rem remaining files in TEMP will be ica.log and tmp.ica | |
60 | start %icafile% | |
61 | rem sleep 2 | |
62 | rem del %icafile% | |
63 | rem echo %DATE% %TIME% %1 >>ica.log | |
64 | popd | |
65 | goto eof | |
66 | ||
67 | ||
68 | :HELPTEXT | |
69 | @echo. | |
70 | @echo Syntax: %0 ^<hostname^> [ ^| 0 ^| 1 ^| 2 ^| 3 ^| 4] | |
71 | @echo where the integer sets resolution: | |
72 | @echo 0 - 320x240 | |
73 | @echo 1 - 512x384 | |
74 | @echo 2 - 640x480 | |
75 | @echo 3 - 800x600 | |
76 | @echo 4 - 1024x768 | |
77 | @echo 5 - 1152x864 | |
78 | @echo. | |
79 | @echo If no size chosen, defaults to 640x480 | |
80 | @echo. | |
81 | ||
82 | :eof |