I have a remote machine and I want to get all logged in user details. I wrote the code using cassia as follwoign using this link
ITerminalServicesManager manager = new TerminalServicesManager();
using (ITerminalServer server = manager.GetRemoteServer("SERVERIPADDRESS"))
{
server.Open();
foreach (ITerminalServicesSession session in server.GetSessions())
{
NTAccount account = session.UserAccount;
string userName = session.UserName;
if (account != null)
{
Console.WriteLine(account);
}
}
}
Now I want to connect to this server using a particular UserId
and Password
. How can I do it? I am not getting any option for that.
What I tried is, I gave the server ip address and build the solution. Then I tried the exe
file as a different user and giving credentials but failed to login.
Can anyone please help. I am ready and open to ditch Cassia, but want a working solution.
And please help me tagging this question, I cant get my mind around it.