Wednesday Jul 15, 2009

Not Exactly A Sign Of The Apocalypse...

But far bigger news than cats and dogs sleeping together!  I kid, but how cool is this Microsoft Whitepaper on VDI using Sun Rays!

Monday Jul 30, 2007

Time Zone Redirection and Sun Ray Connector

Suppose you had a centrally located Windows Terminal Server, but you had clients that accessed this terminal server that resided in different time zones than the terminal server.  By default, the time that their programs see would be the time zone of the terminal server.  This can can cause problems with Outlook, or other time sensitive applications.

Microsoft supports a feature called Time Zone Redirection, however it's disabled by default.  Typically if you are doing things the right way you'd have an Organizational Unit (OU) of Terminal Servers (TS) and you could enable TZ Redirection only for that OU via the AD Users and Computer snap in.  However, you can also do it on a TS by TS basis by firing up MMC and doing a local group policy.  Here's the changes you want to make to either the local or group policy:

  1. Select the group policy object you want to edit.
  2. Click Computer configuration, Administrative Templates, Windows Components, Terminal Services, Client Server Data Redirection.
  3. Open Allow Time Zone Redirection.
  4. Click Enabled.
  5. Click OK.

Note:  Changes to this setting only apply to new Windows Terminal Server sessions.

Now, let's throw another wrench in the fan.  The above works great when you have a fat client (that includes Wyse, Neoware, etc) as they keep their own clock because they have an OS and on that local OS the RDP client  runs so that's where the time zone is determined.

What if you had a Sun Ray Server on the West Coast, a Terminal Server in the midwest, and a Sun Ray on the East Coast?  Even with the above changes, the TS Session is going to reflect the Pacific time zone since the Sun Ray Server is the client because that's where the RDP client runs and therefore where the TZ is determined.

What we want though is to have the TS Session reflect the Eastern time zone, otherwise the users time sensitive applications are going to be really messed up.  Mail will have the wrong time stamps, they'll be late for appointments, etc.

What you can do is change the time zone variable on the fly.  You can even automate this so a look up is done in the Sun Ray Data store for this particular Sun Ray.  Meaning you could store the time zone information in the other or location field of the DTU.  If you only had a few you could do a simple if/then script based on the MAC address as well.

For the sake of this example let's say that we stored the time zone information in the location field of the Sun Ray Data Store for a particular Sun Ray that is on the East Coast.  That means in the location field for this Sun Ray we have the words "US/Eastern".  Then we could do the following script:

MYDISP=`echo $DISPLAY | awk -F: '{print $2}' | awk -F. '{print $1}'`
MYMAC=`grep TERMINAL /tmp/SUNWut/config/dispinfo/$MYDISP | awk -F. '{print $2}'`
MYTZ=`/opt/SUNWut/sbin/utdesktop -Lc |grep $MYMAC | awk '{print $5}'`
if [ "$MYTZ" ];then
TZ=$MYTZ;export TZ
/opt/SUNWuttsc/bin/uttsc <options>

What you'd get then is what is demonstrated in the screen shot below.  While the Sun Ray Server is actually on the Pacific time zone, we've changed the TZ variable under Solaris (or Linux) to reflect the Eastern time zone and that's what is reflected in the Terminal Server Session.  This works just fine in Kiosk/CAM mode as well, it's just easier to illustrate from a normal session since we can see both clocks.  Remember though, you must have TZ Redirection enabled on the Terminal Server and Sun Ray Windows Connector 1.1 or greater for this to work.


Wednesday Feb 28, 2007

utaction for Windows

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:;action=display;threadid=685

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!



Think Thin is a collection of bloggers that work with Oracle's Virtual Desktop portfolio of products.


« July 2016