Mini Blog: Checking processor performance

I haven’t been blogging alot lately, mostly due to renovating at home and having very large projects in the office. To compensate I’ve decided to write some quick mini blogs to make sure I don’t lose the magic 🙂

I’ve found with some application monitoring I’ve been setting up it was required to make a quick snapshot of how heavy the processor was being used during my scripts, as the application made some SQL queries it could create spikes in the CPU that I wanted to avoid.

To take a quick snapshot of the current values of the processor status, I’ve used the get-counter cmdlet and retrieved the cooked value of this to query it further;

$CPUQueueLength = (get-counter -counter "\System\Processor Queue Length").countersamples.cookedvalue

$CPUUSerTime = (get-counter -counter "\Processor(*)\% User Time").countersamples.cookedvalue

$CPUPrivTime = (get-counter -counter "\Processor(*)\% Privileged Time").countersamples.cookedvalue

Happy scripting 🙂

Kelvin Tegelaar Author

I am a Microsoft Certified System Engineer working for the Managed Services Provider Lime Networks B.V. in the Netherlands. I mostly enjoy automating business processes by deploying PowerShell solutions, but just have a large passion for Microsoft Technology in general. If you want to contact me directly you can find me on twitter here, or via email: Kelvin {at} limenetworks.nl

Leave a Reply

Your email address will not be published. Required fields are marked *