PoshTip #5 – Measure your Powershell script
First method
PowerShell has a built in command Measure-Command. It is a great cmdlet to quickly find how much a command takes to execute.
Measure-Command { Get-Process }
If you want to see the output
Measure-Command { Get-Process | Out-Default }
Second method
You can also use the .NET Stopwatch object
$MeasureCMD = [Diagnostics.Stopwatch]::StartNew() Get-Process $MeasureCMD.Stop() $MeasureCMD.Elapsed