System.Diagnostics.Process.GetProcesses Error Message

Posted on 2006-05-12
Last Modified: 2012-06-27
Hello everyone,

I've been getting this error message when I try to execute this code:


So far, I've granted the ASPNET user account access to the performance counter group because I was getting an Access Denied error, that is fixed and now I get this error:

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

I've been trying to figure out how to enabled the process performance counter but I can't figure it out.

Can anyone show me how to do this?
Question by:quanmac
    LVL 11

    Expert Comment

    Microsoft recommended an only workaround which is to add the user to Performance Counter Users Group
    LVL 3

    Author Comment

    The Performance Counter Users Group is missing from my list of groups.

    I have:

    Performance Logs Users
    Performance Monitor Users

    I've added the account to both of these and I still get the error:

    Process performance counter is disabled, so the requested operation cannot be performed.
    LVL 11

    Accepted Solution

    The ASPNET account (configured by default) impersonated by the worker process has no privileges to access this API. You should use a higher
    privilege account with the required permissions. Unfortunately, this goes against the principle of the low privilege account (ASPNET account is a good sample of this), so one thing you could do, is to authenticate the site with an administrator like account or any account with the required privileges, and use impersonation true in the web.config file. This way, nobody with the required permissions will be able to access restricted resources.

    You could do that, say in the web.config or the machine.config
    file. You might want to check out this article:

    306158.KB.EN-US INFO: Implementing Impersonation in an ASP.NET Application

    You could also take a look at this article for more infor on the process
    identity used by

    317012.KB.EN-US INFO: Process and Request Identity in ASP.NET

    LVL 3

    Author Comment

    So if i impersonate an account with the required priviledges, then wouldn't be able to access anything else except for the web app?

    I am worried that someone would be able to gain access to the OS and manipulate it.
    LVL 3

    Author Comment

    Am I able to impersonate an account in my C# code and run the System.Diagnostics.Process.GetProcesses() line and then revert back to the ASPNET account?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This video discusses moving either the default database or any database to a new volume.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now