>Hi all,
>
>Have used GETENV("SessionName") in one spot in my code to detect if the user was logging on via a Terminal Server (RDS, 2008R2) and if so, automatically set some print options for them. (the user's fire up their app via a shortcut on their RDC desktop which points back to their app on another file server).
>
>But it has been mis-behaving lately (or maybe it always did and they did not report it). Somtimes SESSIONNAME returns "RDP-Tcp#x" and sometimes it is empty. (it should return "Console" for non-RDC sessions). I put some code into their app to display the value of SESSIONNAME. Sometimes it is populated, other times it is not.
>
>If I open a DOS prompt on the server, it is always populated. Likewise, if I launch the app by first launching a command session:
>
>C:\Windows\System32\cmd.exe /c "F:\Claims\Mk.exe" (i.e. the shortcut)
>
>It seems to always populate. (BTW, I figured that out as that was the only way I could get the app to be pinned to a Windows 7 taskbar, but that is another story).
>
>Anyone know what's up with SESSIONNAME - or is there an easier, goof-proof way to detect if the user is in an RDC session?
>
>Albert
faq#31877 ?
Gregory