From the earlier thread (https://www.experts-exchange.com/questions/29216276/Using-VB-Net-or-C-Net-List-active-user-logged-into-a-machine-and-kill-the-session.html
) we are able to list users and log off users on local machine when using
IntPtr ptrOpenedServer = WTSOpenServer(ServerName)
[DllImport("wtsapi32.dll", SetLastError = true)]
static extern bool WTSLogoffSession(IntPtr hServer, int SessionId, bool bWait);
where "ServerName" is "localhost".
However, when specifying the ServerName with the remote machine, we are not able to log off the user.
Could you please let us know if there is a way to log off user on a remote machine on the same network with no firewall restrection between the two machines?
FYI, we are able to get the list of the logged in users using the code mentioned in the earlier thread
Thank you very much.