PowerTip: Use PowerShell to Find Total CPU Time

PowerTip: Use PowerShell to Find Total CPU Time

  • Comments 2
  • Likes

Summary: Use Windows PowerShell to find the total CPU time of a process.

Hey, Scripting Guy! Question How can I return a timespan that represents the total CPU time of a process?

Hey, Scripting Guy! Answer Use the Get-Process cmdlet and select the TotalProcessorTime property:

PS C:\> (gps excel).totalprocessortime


Days              : 0

Hours             : 0

Minutes           : 0

Seconds           : 4

Milliseconds      : 524

Ticks             : 45240290

TotalDays         : 5.23614467592593E-05

TotalHours        : 0.00125667472222222

TotalMinutes      : 0.0754004833333333

TotalSeconds      : 4.524029

TotalMilliseconds : 4524.029 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Hi

    Love these new powertips. They are great learning tools that allows me to incorporate them in my scripts that I am writing. Thank you very much.

  • @John I am glad you love the new PowerTips. I was not certain how well they would do when I first started writing them. I now have several months worth of PowerTips, and they have their own tags. You can see only the PowerTips here:  blogs.technet.com/.../powertip