Script to restart a service based on CPU Usage.

Posted on 2012-09-18
Last Modified: 2013-06-07
Hi All,

I am looking for a script to run on my windows server based on a CPU Utilization.

it should be like, if the particular process start utilizing >60% of CPU, than script should automatically restart the particular service..

Please help me .


Question by:Vikas Shah
    1 Comment
    LVL 65

    Accepted Solution

    Hi, you would be better off setting up a performance counter with perfmon, like this:

    and then set an alert for the counter, and trigger it to "run this program", more detail here:

    When you use "Run this program", enter a batch file path, and in that batch file, put this:
    net stop w3svc
    net start w3svc



    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
    Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    734 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

    19 Experts available now in Live!

    Get 1:1 Help Now