How do I logoff a user via a Windows Service?
I found this example here but it will not work in a service. http://www.c-sharpcorner.com/UploadFile/thiagu304/desktopfunctions02112007140806PM/desktopfunctions.aspx
How do I logoff a user via a Windows Service?
I found this example here but it will not work in a service. http://www.c-sharpcorner.com/UploadFile/thiagu304/desktopfunctions02112007140806PM/desktopfunctions.aspx
Duplicate:
http://stackoverflow.com/questions/221410/remotely-and-programatically-logoff-an-active-domain-user
Check out WTSLogoffSession. It does precisely what you want and is pretty easy to call via PInvoke. To get the session ID use WTSGetActiveConsoleSessionId or WTSEnumerateSessions and WTSQuerySessionInformation.