Tuesday, March 20, 2007


Warren Simondson from CTRL-ALT-DEL.com has released yet another free utility (YAFU) for you to peruse

Hi All

ENVTSCIP is a minor extension of GETTSCIP whereby it sets the client IP address of a user session to an environment variable called CLIENTIP.

This utility was written due to the high demand in emails asking Ctrl-Alt-Del IT Consultancy to produce this tool.

There are another 5 Utilities in the pipeline all due out soon.

As always, get the utilities from http://www.ctrl-alt-del.com.au/CAD_Utils.htm

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

 This utility is FREEWARE and was written by Warren Simondson of
Ctrl-Alt-Del IT Consultancy, Australia.  http://www.ctrl-alt-del.com.au/
Thankyou to the WINDOWS SDK available from  http://msdn.microsoft.com/downloads
This command will return the client ip address of a session as:
 WTSClientAddress: 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:  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.
@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 Unable to retrieve path.
Goto Finish
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

Warren Simondson
Ctrl-Alt-Del IT Consultancy Pty Ltd

No comments: