PowerTip: Measure the Time for a Command to Complete

Summary: Learn how to measure the time for a Windows PowerShell command to complete.

Hey, Scripting Guy! Question How can I see how many seconds it takes to retrieve objects from the application log?

  Hey, Scripting Guy! Answer

 (Measure-Command { Get-EventLog application }).totalseconds

Comments (5)

  1. Anonymous says:

    It took me this long:


    That’s with Windows 8.1 Ent (2)SSD in Sata Array 5 (not true RAID)

  2. It took me this long.


  3. Walid Toumi says:


    "to measure the time for a Windows PowerShell command to complete"

    —> it can also measure external application (no PowerShell command)

    PS II> (Measure-Command { tasklist /s sv1 }).totalseconds

  4. Ed Wilson says:

    @Walid Toumi this is excellent. I have never thought of using Measure-Command to measure anything but PowerShell … it makes perfect sense. Cool. Thank you so much for sharing.

  5. Perl F Anatic says:

    Does Measure-Command account for other processes running at the same time as the one you are timing? For example the virus scan kicked in while I was timing a long test of several scripts now I'm not sure which ones are valid tests.

Skip to main content