October 22nd, 2015

PowerTip: Measure Performance of PowerShell Command

Doctor Scripto
Scripter

Summary: Measure how long it takes for a Windows PowerShell command to complete.  

Hey, Scripting Guy! Question If I change one command to try to improve the speed of my Windows PowerShell script , how can I see if
           that command is faster than the one I changed?

Hey, Scripting Guy! Answer Use the Measure-Command cmdlet. For example, to see if Get-Date or [datetime]::now is faster,
           place the command in a script block as shown here:

Measure-Command -Expression {get-date}

Measure-Command -Expression {[datetime]::now}

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.