I get a list of all running processes on my computer like this:

static void AllInfoProcess() { var myProcess = from proc in Process.GetProcesses() orderby proc.Id select proc; Console.WriteLine("\n*** Текущие процессы ***\n"); foreach (var p in myProcess) { Console.WriteLine("-> PID: {0}\tName: {1}", p.Id, p.ProcessName); } Console.WriteLine("Всего процессов запущено {0}", myProcess.Count()); } 

I need to get a list of processes on the remote machine. In my case, I installed a virtual machine (VirtualBox), configured the connection type between my OS and the Virtual Host Adapter virtual machine. And it seems as if using the same method, only with the ComputerName parameter will output all processes running there, but no matter how I wrote, it outputs processes from the local OS.

 System.Diagnostics.Process.GetProcesses("ComputerName"); 

Can you please tell me how to display the processes running on the remote machine?

  • @AK I only have a computer and I’ve made a virtual machine (I checked, they ping in both directions, the main Windows 7 and on the virtual machine 7. I’m not typing in brackets (name) displays the processes from the current OS anyway ((maybe you need to configure something virtualka yet? - Alexey
  • Please tell me your question about .NET Framework or .NET Core? - Vadim Ovchinnikov

1 answer 1

Just as you wrote.

I have your example perfectly works for the first virtualka in the local network.

The docks have comments about win98 and other old OS, this is not your case, right?

But most likely, the problem is caused by the fact that you are trying to connect to the OS inside the virtual machine and do not fall.

Check if the virtual machine is available outside: can you ping the virtual machine from the host machine. Can you, under the user running the program, connect to another computer with administrator rights, for example, to c $ - this will be very revealing, since you, if not the domain, like me, you may simply not get the necessary rights by remote machine.

It is possible that the virtual machine shares the IP address with the host machine (in VMWare, this is exactly the network mode; in VirtualBox, it can also be).

Try to check the neighboring machine on the network, and not the virtual machine. Perhaps you have a home grid and in addition to your computer there are also relatives' cars.

  • What does the IP address mean? ip 192.168.56.1 for host and ip 192.168.56.101 for virtualke and I seem to be doing everything right, as I wrote above, but only the host processes all the time ( - Alexey
  • I have now connected the laptop to the router, I am writing the name of the computer and still gives out processes that are on my computer and not those that are there (( - Alexei
  • @Alexey Are you sure that these are the processes of the main computer and not the remote one? They are very similar, run a process on a remote computer that is not on the main (at least a notepad) and check. - AK
  • Checked of course ((150-160 processes are running on the host, and 100-110 on the laptop, at the end I just output the number of all the processes and it shows where you can create a connection to the guest computer somewhere else somewhere? - Alexey
  • @Alexey, check whether it is possible to connect and query processes using the Sysibternals utilities, namely pslist. If the connection is normal and you receive a list of processes - then everything is ok. But keep in mind that you definitely need to start the server (lanmanserver) and remote registry services (remoteregistry) - Justicet