Forum Discussion
shankar_r
Community Hero
Hi,
Not sure what you are asking, Do you want to have a Boolean value which will say whether RDP instance is running in the current machine?
m_essaid
7 years agoValued Contributor
hi Shankar,
yes, is there a way to know that ?
thanks, Mehdi
- shankar_r7 years agoCommunity Hero
Hi,
I know we can check whether the RDP application is opened in current machine using below code,
function isRDPRunning() { return Sys.Process("mstsc").Exists; }
Not sure, How to check whether that RDP is connected to any VM or server.
- baxatob7 years agoCommunity Hero
If you want to know, how you have connected to server, you can use system environment variables.
E.g. - <SESSIONNAME> should return RDP-Tcp#0 if you are connected using RDP.
In Python you can create a function:
import os def is_rdp_connected(): if os.environ.get("SESSIONNAME") == "RDP-Tcp#0": return True else: return False
P.S. Note, that if another users are connected via RDP, the <SESSIONNAME> value can be RDP-Tcp#1, 2, ..., n