C# GetRemoteServer - no domain?

164 views
Skip to first unread message

Rafal Truszkowski

unread,
Jun 19, 2012, 12:52:03 PM6/19/12
to cassia...@googlegroups.com
I have 10 remote servers with one local account on each of them. I want to create a C# application that displays owners of certain processes on these servers.

ITerminalServer server = manager.GetLocalServer();
server.Open();
try
{
     foreach (ITerminalServicesSession session in server.GetSessions())
          {
               MessageBox.Show("open");
               if (session.ConnectionState == ConnectionState.Active || session.ConnectionState == ConnectionState.Disconnected)
                   {
                       string ip = session.ClientIPAddress.ToString();
                       System.Collections.Generic.IList<Cassia.ITerminalServicesProcess> list = session.GetProcesses();
                       int count = list.Count;
                       Cassia.ITerminalServicesProcess item;
                       for (int k = 0; k < count; k++)
                       {
                            // trolls working hard on processes
                       }
                    }
          }
}
catch { MessageBox.Show(":(");}

Now, this app would have to be run on each of the remote servers each time a user logs in. I want every external user to have their own app, on their Desktop. I wanted to user GetRemoteServer("servername"), but I can't get it to work.

When I change the very top line to ITerminalServer server = manager.GetLocalServer("192.168.0.218"), I am not getting a MessageBox - the execution skips to the catch section...

I read some posts about computer not being in the same DOMAIN. As far as I know, none of the computers here are in a domain. Am I missing something?
Please help.

Thanks!!

Dan Ports

unread,
Jun 19, 2012, 5:58:57 PM6/19/12
to cassia...@googlegroups.com
Rafal,

What exception is being thrown?

I'm guessing that since the machines are not all on the same domain, you're seeing an access denied error. The user account under which the code is running needs to permissions to query session information on the remote server. In the workgroup setting, you'll probably need to impersonate an account on the remote system to accomplish this. See issue 32 and the links in the comments there for more information on impersonation.

Dan

--
You received this message because you are subscribed to the Google Groups "Cassia Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cassia-users/-/EGEgGZEy-PUJ.
To post to this group, send email to cassia...@googlegroups.com.
To unsubscribe from this group, send email to cassia-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cassia-users?hl=en.

Reply all
Reply to author
Forward
0 new messages