What API will allow me to detect and end the session of someone using "mstsc /console"?
I'm having a very difficult time listing and closing the sessions of folks using Mstsc /admin.
Does anyone know the AP开发者_运维问答I to use if the server is a normal server and not a terminal server per-se?
You can use the LsaEnumerateLogonSessions function to get a list of all logged in sessions, and use LsaGetLoginSessionData to determine what type of session it is.
If you're only interested in remote desktop sessions, WTSEnumerateSessions might be helpful as well. If you'd like to force a logoff, you can use WTSLogoffSession.
You can start with WTSEnumerateSessions or WTSEnumerateSessionsEx.
精彩评论