I am trying Writing a remote desktop client for use in my testing environment.
The goal is to logon to a computer (new virtual machine) for the first time, let the user profile and everything that happens during the first logon happen, and then log off.
I'm able to create the session and logon to the computer as the user using the MSTSCLib/AxMsRdpClient6NotSafeForScripting interfaces.
Now I am wanting to log the user off the computer (not just disconnect) using the WTSLogoffSession function. But this function requires the Session ID and I cannot figure out how to find it for the current session running in the RdpClient interfaces.
Where/how do you find the session id for the session in the RDP session that you have created? It seems like this should be a property or something easily found somewhere but I have found it anywhere.
I assume that I am going to hit myself in the head when a simple solution is given, but it is avoiding me so far.
Thanks