I was wondering if there is a way in python to determine the idle time
for a terminal server session as QUERY USER does.
Also, is there a way to get that python code to run for a server other
than the one running the code (as in QUERY USER /SERVER:name)?
While I don’t have a huge environment to test in, this seems to work remotely
from my win 10 pc to my Windows Server 2016 which has remote admin RDP enabled…
I would assume it’s the same APIs to talk to a full fledged WTS Server.
Kudos to the internet for having the answer already written down
Ok.. fine… I was interested so I played with it more. Here’s what I came up
with. Enjoy!
import win32ts
protocols = {
win32ts.WTS_PROTOCOL_TYPE_CONSOLE: "Console",
win32ts.WTS_PROTOCOL_TYPE_ICA: "Citrix",
win32ts.WTS_PROTOCOL_TYPE_RDP: "RDP",
}
session_types = {win32ts.WTSConnec