Question: In c#, I am using the following code:

```
Process[] processes = Process.GetProcesses("firefox.exe");
Console.WriteLine(processes.Length);

```

Which results in:

> 
> InvalidOperationException: Couldn't connect to remote machine.
> 
> 
> 

Notes:

* OS: Windows 7, 64-bit
* I am **not** attempting to connect to a remote machine.
* The Remote Registry service is set to **Auto** and is **started**

Any thoughts as to why am I getting this error and how can I fix it?

Answer: 
According to <http://msdn.microsoft.com/en-us/library/x8b2hzk8.aspx> this call tries to connect to a computer names "firefox.exe" and retrieve the processes from there hence the exception.

EDIT:

Assuming you want to find all "firefox.exe" processes on the local machine you could

```
List<Process> ListOfFireFox = new List<Preocess>();
foreach (P in Process.GetProcesses())
{
    if ( P.ProcessName.ToLower() == "firefox.exe" )
         ListOfFireFox.Add (P);
};

Console.WriteLine(ListOfFireFox.Count);

```
You think you are specifying a process name, but you are actually specifying the machine name.

```
Process[] Process.GetProcesses(string machineName);

```

Hope this helps,
John