Measuring Cmdlet Execution Time

If you’ve ever wondered how long it takes to perform a specific task then the Measure-Command cmdlet is exactly what you’ve been looking for: it enables you to measure the running time of a command or script down to the millisecond. Simply call the cmdlet you want to profile, using the command or script to be run as the cmdlet parameter inside curly braces.

For example, you can measure the time it takes to get a list of all the running process on the local computer (or on a remote one) by means of the Get-Process cmdlet: open the Powershell window and execute the following command

PS C:\Users\Luigi\Measure-Command {Get-Process}

You'll get an output like the following (captured from an English Windows 7 with Powershell version 3)

See Also


Other Languages

This article is also available in the following languages:

Italian (it-IT)

Hindi (hi-IN)