I looked at the function, and it won't work for XD. For XA it works (at least in Win2k8 or Win2k8R2) because the sessionID is part of %temp% (i.e. if my session ID is 23, then my temp variable really points to %userprofile%\appdata\local\temp\23).

In XD, this is not valid. :-\ The CLIENTNAME is absolutely in the registry for XD (It is for XA also, but it is also predicated on sessionID (hklm\software\citrix\ica\session\\clientname.

I'll login from another machine, and I can post some screenshots.

Again, I really appreciate the help.. I have been racking my brains for 3 days on this.