Skip to content

Instantly share code, notes, and snippets.



Last active May 21, 2019
What would you like to do?
measure command time
function time([scriptblock]$scriptblock) {
$sw = [Diagnostics.Stopwatch]::StartNew()
. $scriptblock
Write-Output ""
Write-Output " >> Execution time: $($sw.Elapsed)"
time { Install-Module -Name PSWindowsUpdate }
$categories = 'Critical Update','Security Update','Definition Update','Service Pack','Update Rollup'
time { Get-WUInstall -Install -Category $categories -Verbose -AcceptAll -IgnoreReboot }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.