ENVTSCIP is a command-line tool for Terminal Servers to query the current session's client ip address and display it in the command line, as well as set it to a VOLATILE ENVIRONMENT VARIABLE - %CLIENTIP%. This utility is FREEWARE and was written by Warren Simondson of Ctrl-Alt-Del IT Consultancy, Australia. www.ctrl-alt-del.com.au Thankyou to the WINDOWS SDK available from http://msdn.microsoft.com/downloads Usage: ENVTSCIP E.G. ENVTSCIP This command will return the client ip address of a session as: WTSClientAddress: 192.168.0.141 and also store it as an environment variable %CLIENTIP% E.G. ENVTSCIP>ipaddress.txt This command will return the client ip address of a session as: WTSClientAddress: 192.168.0.141 and store it in the text file ipaddress.txt. It will also store it as an environment variable %CLIENTIP% Using ENVTSCIP in assigning an Environment Variable is best executed from startup or the RUN section located in the registry. This will ensure it can be used throughout an active session. For using ENVTSCIP in logon scripts, please see ENVTSCIP.txt included. in this package. The freeware version is offered AS IS. Ctrl-Alt-Del IT Consultancy has made every effort possible to ensure that ENVTSCIP is free of any bugs or errors, however in no way is ENVTSCIP to be considered error or bug free. You assume all responsibility for any damages or lost data that may result from any errors or bugs in ENVTSCIP. IN NO EVENT WILL Ctrl-Alt-Del IT Consultancy BE LIABLE TO YOU FOR ANY GENERAL, SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR OTHER DAMAGES ARISING OUT OF THIS PRODUCT. USRLOGON.CMD EXAMPLE ==================== @Echo Off :: call the client ip utility that assigns the environment variable call "%SystemRoot%\System32\envtscip.exe" ::Becasue this is run in usrlogon.cmd, the environment variable cannot be broadcast to the windows shell ::thus we use the old classic Terminal Server tool ACRegL to enforce the variable during the logon script "%systemroot%\Application Compatibility Scripts\ACRegL.exe" "%TEMP%\getpaths.cmd" CLIENTIP "HKCU\Volatile Environment" "CLIENTIP" "" If Not ErrorLevel 1 Goto Cont1 Echo. Echo Unable to retrieve path. Echo. Goto Finish :Cont1 Call "%TEMP%\getpaths.cmd" Del "%TEMP%\getpaths.cmd" >Nul: 2>&1 ::The environment variable %clientip% can now be used throughout this script ::To use the environment variable %clientip% within a session run ENVTSCIP.exe in the startup of the user's session ::or the RUN section of the registry ::just as a test echo the variable to the screen echo %CLIENTIP% :Finish