2

Is there a way to get running applications of task manager (not the processes) from another computer? By any chance using the other pc's IP Address or pc name?

Here's my code but all it does is displaying my running applications and updates every second to see if I open or close any program.

UPDATE: I used impersonator but I still get the same error "Couldn't connect to machine". As for the impersonator, I just downloaded this Impersonator

private void Form1_Load(object sender, EventArgs e)
    {
        timer1.Enabled = true;
    }

 private void running_process()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("ProcessName");
        dt.Columns.Add("ProcessId");
        using (new Impersonator("adminuser", "", "adminpass"))
        {
            Process[] processes = Process.GetProcessesByName(".", "PCNAME");
           //Process.GetProcesses("192.168.20.120")
            foreach (Process p in processes)
            {
                try
                {
                    if (p.MainWindowTitle.Length > 0)
                    {
                        dt.Rows.Add();
                        dt.Rows[dt.Rows.Count - 1][0] = p.MainWindowTitle;
                        dt.Rows[dt.Rows.Count - 1][2] = p.Id.ToString();
                    }
                }
                catch { }
            }
        }

        listBox1.DataSource = dt;
        listBox1.DisplayMember = "ProcessName";
        listBox1.ValueMember = "ProcessId";
    }
    private void timer1_Tick(object sender, EventArgs e)
    {
        running_process();
    }
NatsuDragneel
  • 297
  • 1
  • 4
  • 21

2 Answers2

1

You can use Process.GetProcesses("remotecomputername"). Or...

You can list the processes running on a remote computer by using a tool called pslist. This articles describes how: Determine processes running on a remote server with PsList. But in order to do this you need to have admin level permissions on the remote server. (This is not a problem I think. Because I don't see how you would be able to do this without admin privileges anyway).

You do not have to install the tool in the computer. You can run it from Sysinternals Live.

 \\live.sysinternals.com\tools\pslist \\remotecomputername

Then you will have to Execute command line in C#, get STD OUT results. Then it should be a trivial task to tokenize the output and get the information you need.

Community
  • 1
  • 1
sampathsris
  • 21,564
  • 12
  • 71
  • 98
  • I don't have a admin account on our server, if ever I do have one is there another way beside using a 3rd party program? – NatsuDragneel Jul 15 '14 at 06:34
  • I have no idea how to do this using C# code. But eventhough pslist is a 3rd party program, it is hosted to act much like a web service. So if the requirement is vital I wouldn't mind using it. – sampathsris Jul 15 '14 at 06:36
  • But the link's picture shows the processes the one I need is the running application (Application Tab of Task Manager) check my code you'll see what I mean. – NatsuDragneel Jul 15 '14 at 06:42
1

Process [] ipByName = Process.GetProcessesByName("notepad", "169.0.0.0");

Please refer the link http://msdn.microsoft.com/en-us/library/1f3ys1f9(v=vs.110).aspx

renjucool
  • 314
  • 8
  • 19