Skip to content

Instantly share code, notes, and snippets.

@gravejester
Created April 21, 2015 13:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
function Start-Timer {
<#
.SYNOPSIS
Set the global timerStart variable.
.EXAMPLE
Start-Timer -Silent
Will set the variable, and not output anything
.EXAMPLE
Write-Verbose (Start-Timer)
Will set the variable, and write the start time to the verbose stream.
.NOTES
Author: Øyvind Kallstad
Date: 19.04.2015
Version: 1.0
#>
[CmdletBinding()]
param (
# Do not output anything.
[Parameter()]
[switch] $Silent = $false
)
$global:timerStart = Get-Date
if (-not($Silent)) {
Write-Output $global:timerStart
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment