utaction for Windows
By ThinGuy on Feb 28, 2007
While I was lurking around Brian Madden's site, I stumbled upon a free tool called ReconnACT from Log\*in Consultants out of the Netherlands.
Like utaction it performs actions on a session start, a disconnect, and a reconnect. Except it does this based on session starts, disconnects and reconnects of a terminal server session
If you couple this with Device based TS CAL's, Sun Ray Connector for Windows, and you don't use the optimized hot desking switch (i.e the -O option) you can do some pretty cool things should you hot desk to another DTU. Like tell an application that the client has changed, or perhaps a utaction on the Sun Ray Server side could call a script that would scribble information into a text file on a mapped drive. Then you could run a windows based script based on the information in that text file. Maybe it's a COM port change, or a printer change. Maybe it's someone connecting from a DTU on a disallowed subnet so you end their Windows session.
You can download Reconnact 1.3 here:
Extract the file ReconnAct!.exe (Don't use ReconnAct!2K.exe as that is only for windows 2K) and place it in C:\\Windows\\system32
You can download some sample scripts I put together here::
Extract my scripts to the the root of the C: drive on your terminal server. It will create a directory structure called C:\\reconnact.
Then set your logon script (via whatever method you like, GPO would be best) for windows to run c:\\reconnact\\reconnact.cmd. If implementing on a domain, move the reconnact directory to a public share somewhere. You'll have to change the scripts up a bit to reflect the new location.
Reconnact will then run:
C:\\reconnact\\start.cmd on startup
C:\\reconnact\\discon.cmd on a disconnect
C:\\reconnact\\recon.cmd on a reconnect.
Under the C:\\reconnact you will see folders called S, D, and R. (S for Start, D for disconnect and R for reconnect). Just simple naming, play along for the how to, then change to what ever suits your needs.
The start, discon, and recon scripts look in these directories for script (cmd files) and runs each one it finds. So if you wanted to add another disconnect action you wouldn't have to edit the login script, you'd just drop a command file in the the D file.
Right now I have a sample script in each directory to pops up a message stating "Start Message", "Reconnect Message", etc. The disconnect message won't show, unless you happen to shadow the disconnected sessions since you have to be connected to see it work. If you'd like to see it do something on a disconnect change C:\\reconnact\\D\\hello.cmd to do something like launch the control panel (i.e. replace the script contents with the words "control.exe")
Here's a screen shot from a new connection. Nothing much to see here that you couldn't do with a login script, something under the Run registry key, or even the Startup programs group.
The coolness factor comes into play when you disconnect or reconnect. If you are using non-optimized hot desking with the Sun Ray Connector for Windows to a Terminal Server in Device Mode for TS CAL's, we actually disconnect and then reconnected you to ensure proper allocation of CAL's . The following image shows the above mention change to run control panel on a disconnect and then you also see the reconnect message.
Note this will not work if you are in User licensing mode for your TS CAL's. Your session will not get disconnected regardless of the optimized hot desking switch as we do not need to track device based CAL's. You could however use xvkbd via utaction to send a disconnect sequence or even kill your Sun Ray Connector PID as a work-around.
Would be great in the world of VDI, except it does not run on XP. I've exchanged a few emails with Log\*in Consultants, but nothing much has transpired. I'd love to see something agent based that could be called from the Sun Ray Session that would do certain windows functions based on DTU connects and disconnects. Most likely that's something Sun will have to write themselves.
Nonetheless, it's still worth checking out. It's a great tool for terminal server if for nothing else than to forcefully log off those timed out disconnected sessions!