Click here to Skip to main content
14,576,147 members
Rate this:
Please Sign up or sign in to vote.
See more:
i'm trying to launch application that works well on Win7, but on Win10 causes an error.

GetProcessesByName with parameter "| does not work on Win10.

anyone knows why?

static void Main(string[] args)
                Process[] processesByName = Process.GetProcessesByName("vshost32.exe", "");
                if (processesByName.Length == 0)
            catch (InvalidOperationException exception)



DESKTOP-SJPDB4K\Administrator [2020-05-24 18:37:56,286] ERROR - Error checking process status
System.InvalidOperationException: Cannot connect to remote machine. ---> System.InvalidOperationException: Cannot read value from counter performance. ---> System.ComponentModel.Win32Exception: Cannot find remote path.

   w System.Diagnostics.NtProcessManager.GetProcessInfos(String machineName, Boolean isRemoteMachine)
   w System.Diagnostics.Process.GetProcesses(String machineName)
   w System.Diagnostics.Process.GetProcessesByName(String processName, String machineName)

What I have tried:

i tried many things like
- changing settings of firewall
- disabling firewall
- add a line " localhost" to c:\windows\system32\drivers\etc\hosts

nothing helped.
Updated 1-Jun-20 7:13am
Maciej Los 1-Jun-20 11:48am
Does Win10 is 32 or 64bit?
Member 14850091 1-Jun-20 12:32pm
System is 64bit, application is 32bits
Maciej Los 1-Jun-20 12:45pm
This might be the reason. Have you tried to compile your programme with different options (32/64bit)?
Richard MacCutchan 1-Jun-20 12:56pm
Why are you using the IP address of your own machine? Use the version of GetProcessesByName that does not require a hostname.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100