Last active
February 28, 2024 23:44
-
-
Save deadlydog/d04b5d43170a90d8bc0143373d90010f to your computer and use it in GitHub Desktop.
PowerShell template for a single-file script
This file contains 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
[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