function webSiteHealthCheck{ [CmdletBinding(SupportsShouldProcess)] param( $URLList ) $result = @() Foreach($Uri in $URLList) { $time = try{ $request = $null ## Request the URI, and measure how long the response took. $result1 = Measure-Command { $request = Invoke-WebRequest -Uri $uri -Verbose } $result1.TotalMilliseconds } catch { $request = $_.Exception.Response $time = -1 } $result += [PSCustomObject] @{ Time = Get-Date; Uri = $uri; StatusCode = [int] $request.StatusCode; StatusDescription = $request.StatusDescription; ResponseLength = $request.RawContentLength; TimeTaken = $time; } } return $result } $urllist = ("https://social.technet.microsoft.com/Forums/ie/en-US/955754db-e85b-4cf9-a516-eaec405706b9/how-to-check-the-availability-of-a-site-using-powershell?forum=winserverpowershell","https://www.google.com","https://www.google.comasdasd") $result = webSiteHea