SyntaxFix
Write A Post
Hire A Developer
Questions
You can also get the last command from history and subtract its EndExecutionTime from its StartExecutionTime.
EndExecutionTime
StartExecutionTime
.\do_something.ps1 $command = Get-History -Count 1 $command.EndExecutionTime - $command.StartExecutionTime