Great, thanks for your help.

I also found @TSSESSION returns 0(zero) on console and it returns 1(One) in RDP session. Is it o.k to use @TSSESSION to detect RDP?

Any suggestions?