Process performance counter is disabled

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

I'm trying to get the process id of some application and I get an error for this line:

Process [] myApplications= Process.GetProcessesByName("MyApplication");

The error says:

System.InvalidOperationException: Process performance counter is disabled, so the requested operation cannot be performed.
at System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLib library)
at System.Diagnostics.NtProcessManager.GetProcessInfos(String machineName, Boolean isRemoteMachine)
at System.Diagnostics.ProcessManager.GetProcessInfos(String machineName)
at System.Diagnostics.Process.GetProcessesByName(String processName, String machineName)
at System.Diagnostics.Process.GetProcessesByName(String processName)

How can I enable the performance counters? Is this required on all computers on which my application will run?

Cheers,
Max
 
Back
Top