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+00:00October 17th, 2016|PowerShell|0 Comments

About the Author:

Chris Meyers
Consultant – Model Technology Solutions Chris has more than 20 years of industry experience. Prior to his work with Model, Chris worked for one of St. Louis’ largest law firms where his responsibilities ranged from implementing Citrix to automating desktop deployments to virtualizing the datacenter. He has also worked with Microsoft’s Rapid Deployment Program to bring new technologies to one of the three largest consumer credit reporting agencies in the US.

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