Skip to content

Instantly share code, notes, and snippets.

@brianbunke
Created January 7, 2017 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianbunke/7a913118b9c7af10cd6456ee5e4c24be to your computer and use it in GitHub Desktop.
Save brianbunke/7a913118b9c7af10cd6456ee5e4c24be to your computer and use it in GitHub Desktop.
Illustrating the initial effects of "Update-ScriptFileInfo -Force"
<#PSScriptInfo
.VERSION 1.0
.GUID a9323abc-0567-4c4f-ad8e-cdd4cb236e3a
.AUTHOR Brian
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
#>
<#
.DESCRIPTION
testing
#>
Param()
function Measure-LastCommand {
<#...#> # stripped here just for brevity's sake
[CmdletBinding()]
param (...) # also stripped here for brevity
If ($ID) {
$Command = Get-History -Id $ID
} Else {
$Command = Get-History -Count 1
}
Write-Verbose "Returning the elapsed time of command: $($Command.CommandLine)"
If ($String) {
(New-TimeSpan -Start $Command.StartExecutionTime -End $Command.EndExecutionTime).ToString('d\:hh\:mm\:ss\.fff')
} Else {
New-TimeSpan -Start $Command.StartExecutionTime -End $Command.EndExecutionTime
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment