
Community Archive (Customer) asked a question.
Measure Website Response Time with Powershell as a Performance Monitor
<#Original script was here
Tweaked slightly to work with WUG.
#>
$url = 'http://google.com'
# track execution time:
$timeTaken = Measure-Command -Expression {
$site = Invoke-WebRequest -Uri $url -UseBasicParsing
}
$milliseconds = $timeTaken.TotalMilliseconds
$milliseconds = [Math]::Round($milliseconds, 0)
$Context.SetValue($milliseconds);
write-host $milliseconds
Excellent....but can anyone add a way to show a zero ms value when the connection is unreachable to this script? Thanks