Skip to content

Instantly share code, notes, and snippets.

@gravejester
Created April 21, 2015 13:44
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