Calling Diagnostics.Process functions

G

Guest

I have a VB.net application that executes the following statement

If
UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then

When I moved it to another machine, I began receiving the following error:

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.dll

Additional information: Process performance counter is disabled, so the
requested operation cannot be performed.


I made sure that:
1. I am logging in an adminstrator account
2.
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\PerfOS\Performance\Disable
Performance Counters is set to 0. I tried deleting it as well.

What else am I missing short of upgrading to Whidbey?

Thanks,
-stephen
 
S

Steven Cheng[MSFT]

Hi Stephen,

Based on my research, such repliance of System.Diagnostics.Process class is
specific to .net framework 1.x. For .net 2.0/vs 2005, it has new
implementation. So are you using .net framework 1.1/vs 2003? Based on my
research

If this is the case, the problem you encountered could happen for any one
of the following reasons:

(a) If Process performance counter is disabled: i.e. "Disable Performance
Counters"
REG_DWORD registry value is set to 1 in the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfOS\Performance

You can find documentation on "Disable Performance Counters" in the
following
knowledge base articles:

Q248993 - 248993 - PRB: Performance Object Is Not Displayed in Performance
Monitor
http://support.microsoft.com/?id=248993

Q249138 - 249138 - INFO: Controlling the Disabling of Performance Monitor
Extensions
http://support.microsoft.com/?id=249138

If this is the case, delete "Disable Performance Counters" registry value.

(b) Counter and Help registry values are missing in the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009

The system shows the Counter registry value information extracted from
%SystemRoot%\system32\perfc009.dat file for English language.
Similarly, the system shows the Help registry value information extracted
from
%SystemRoot%\system32\perfh009.dat file for English language.

If the perfc009.dat and perfh009.dat files are missing in
%SystemRoot%\system32
folder, then the above symptom can also be reproduced.

To resolve this symptom, either you could Export 009 registry key from a
good
system that has the identical Operating System/Service Pack Level and
Import it
into the bad system.

The following knowledge base article documents how to build performance
counter/help information from scratch, if the system is badly affected.

Q300956 - 300956 - How to Manually Rebuild Performance Counter Library
Values
http://support.microsoft.com/?id=300956

Once the system gets to this state, it is difficult to go back and find who
did it.
You could build a similar system from the ground up and monitor suspicious
file/registry activity at the above locations while installing software
incrementally. The sysinternal tools support filters to monitor a subset of
operations like success or failure or based on a string pattern. These are
useful
tools to monitor such activities.

You can use FileMon (for File activity) and RegMon (for Registry activity)
tools
from

<http://www.sysinternals.com/ntw2k/utilities.shtml>

to find the culprit process that modified or deleted the Counter and Help
information. Only local administrators have modify access to the above
information.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top