Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Script to restart a service based on CPU Usage.

Posted on 2012-09-18
1
Medium Priority
?
679 Views
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 .


Regards,

Vicky.
0
Comment
Question by:Vikas Shah
1 Comment
 
LVL 65

Accepted Solution

by:
RobSampson earned 1000 total points
ID: 38416168
Hi, you would be better off setting up a performance counter with perfmon, like this:
http://www.iis.net/learn/troubleshoot/performance-issues/troubleshooting-high-cpu-in-an-iis-7x-application-pool

and then set an alert for the counter, and trigger it to "run this program", more detail here:
http://technet.microsoft.com/en-us/library/bb726968.aspx

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

Regards,

Rob.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Integration Management Part 2
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

578 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