Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Template for a single-file PowerShell script
[CmdletBinding()]
Param
(
)
Process
{
}
Begin
{
$InformationPreference = 'Continue'
$VerbosePreference = 'Continue'
# Display the time that this script started running.
[DateTime] $startTime = Get-Date
Write-Verbose "Starting script at '$startTime'."
}
End
{
# Display the time that this script finished running, and how long it took to run.
[DateTime] $finishTime = Get-Date
[TimeSpan] $elapsedTime = $finishTime - $startTime
Write-Verbose "Finished script at '$finishTime'. Took '$elapsedTime' to run."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment