PowerTip: Measure Performance of PowerShell Command

Doctor Scripto

Dr Scripto

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}

Doctor Scripto
Dr Scripto

Scripter, PowerShell, vbScript, BAT, CMD

Follow Dr Scripto   

0 comments

    Leave a comment