Summary: Figure out how long a Windows PowerShell command takes to run.

Hey, Scripting Guy! Question You want to know how long a particular Windows PowerShell command takes to run so you can optimize your code. How can you do this?

Hey, Scripting Guy! AnswerUse the Measure-Command cmdlet and specify the code in the –expression script block.

Measure-Command -Expression {Get-Process}