Admins Toolbox – PowerShell Execution Time

Hello again have you ever wondered how long it took to execute a powershell script or command?

With a few lines of code we can retrieve that information from your history.

We can pull from history the last executed command and set it as a variable.

$command = Get-History -Count 1 

Using builtin property’s EndExecutionTime and StartExecutionTime we can determine the execution time.

powershell-execution-getmember

Now subtract EndExecution from StartExecutionTime.

$command.EndExecutionTime – $command.StartExecutionTime

powershell-execution-time

Now go forth and execute.

By |2016-10-17T13:23:34-06:00October 17th, 2016|PowerShell|0 Comments

About the Author:

steve bowman

Model Technology

Let us help you get your end point and data center strategy on cruise control!  Ask about our Calibration Assessment.

CONTACT US

  • 12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141
  • (314) 254-4138
  • sales@model-technology.com

RECENT TWEETS