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.


Now subtract EndExecution from StartExecutionTime.

$command.EndExecutionTime – $command.StartExecutionTime


Now go forth and execute.

About the Author: steve bowman

Three Minutes For A More Secure & Efficient Infrastructure

Short and to the point, Steve’s Email Blasts give you endpoint management tips, tricks, and news in three minutes or less email read-time, guaranteed.

Model says no to spam. Privacy Policy

Model Technology Solutions

Model Technology Solutions is a small but mighty band of infrastructure experts. We’ve helped companies in diverse industries to modernize and automate their infrastructures through effectively managing their Microsoft endpoint suite.

With us on your team, you’ll watch your security and compliance go up and your IT team’s costs (and headaches) go down. You’ll relax in knowing that your endpoints will be secure and online when your users need them most. And you’ll finally get back to your most-important tasks.

Model Technology Solutions
12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141

Phone: (314) 254-4138
General Inquiries: model@model-technology.com
Sales and Quotes: sales@model-technology.com