Q. How do I determine exactly how long a cmdlet or script block will take to execute in Windows PowerShell?
John Savill
May 28, 2008
1 Min Read
A. You can use the Measure-Command cmdlet to display a cmdlet's or script block's exact execution time. The following command and output shows the time it takes to execute the Get-Services cmdlet:
Usersjohn> measure-command {get-service}
The output would be:
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 12
Ticks : 120351
TotalDays : 1.39295138888889E-07
TotalHours : 3.34308333333333E-06
TotalMinutes : 0.000200585
TotalSeconds : 0.0120351
TotalMilliseconds : 12.0351
The output from the actual command (Get-Services) isn't shown, so you'd pipe that output to a file.
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like