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: 
Try this following code

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

```
Remove the .exe

```
Process process = Process.GetProcess("firefox");

```