Stopwatches!
When playing with code to try and streamline the process I often add a stopwatch to the logging These are started: $stopwatch=[system.diagnostics.stopwatch]::startNew() Stopped: $stopwatch.Stop() (optional) Restarted: $stopwatch.Restart() Using these through the loggin process can highlight where loops can be improved on or commands take longer than usual (ie timeouts) Write-Output "Lab took $($stopwatch.elapsed.minutes)m:$($stopwatch.elapsed.seconds)s:$($stopwatch.elapsed.Milliseconds)ms to build" More on the stopwatch class https://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch(v=vs.110).aspx