Skip to content

Instantly share code, notes, and snippets.

@deadlydog
Last active February 28, 2024 23:44
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 deadlydog/d04b5d43170a90d8bc0143373d90010f to your computer and use it in GitHub Desktop.
Save deadlydog/d04b5d43170a90d8bc0143373d90010f to your computer and use it in GitHub Desktop.
PowerShell template for a single-file script
[CmdletBinding()]
Param
(
)
Process
{
}
Begin
{
$InformationPreference = 'Continue'
# $VerbosePreference = 'Continue'
# Display the time that this script started running.
[DateTime] $startTime = Get-Date
Write-Information "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-Information "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