Created
February 14, 2018 22:20
-
-
Save jcefoli/b9723a700e029c3c903ea3dc65346198 to your computer and use it in GitHub Desktop.
Time a Powershell Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set Script Start Time | |
$StartTime = Get-Date | |
<# | |
----------- | |
Your script here | |
----------- | |
#> | |
# Set Script Finish Time and do math | |
$FinishTime = Get-Date | |
$TotalTime = ($FinishTime - $StartTime).TotalMilliseconds | |
Write-Host "This script executed in $TotalTime ms." | |
# You can change milliseconds to seconds/ minutes etc: https://msdn.microsoft.com/en-us/library/system.timespan_properties(v=vs.110).aspx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment