title: Cannot bind argument to parameter 'InputObject' because it is null
body: <p>I have a powershell script that measures download time on some pages, however I get the error above, I am unsure what I am doing wrong</p>
  
  <p>error is</p>
  
  <blockquote>
    <p>Cannot bind argument to parameter 'InputObject' because it is null.</p>
  </blockquote>
  
  <pre><code>function ResponseTime($CommonName,$URL, $environment) 
  { 
      $Times = 5
      $i = 0 
      $TotalResponseTime = 0 
        Write-HOst $URL
      While ($i -lt $Times) { 
          $Request = New-Object System.Net.WebClient 
          $Request.UseDefaultCredentials = $true 
          $Start = Get-Date 
          Write-HOst $URL
          $PageRequest = $Request.DownloadString($URL) 
          $TimeTaken = ((Get-Date) - $Start).TotalMilliseconds 
          $Request.Dispose() 
          $i ++ 
          $TotalResponseTime += $TimeTaken 
      } 
  
      $AverageResponseTime = $TotalResponseTime / $i 
      Write-Host Request to $CommonName took $AverageResponseTime ms in average -ForegroundColor Green 
  
      $details = @{            
          Date             = get-date              
          AverageResponseTime     = $AverageResponseTime              
          ResponseTime      = $Destination 
          Environment = $environment
      }                           
      $results += New-Object PSObject -Property $details
      $random = Get-Random -minimum 1 -maximum 30
      Start-Sleep -s $random
  } 
  
  #PRODUCTION
  ResponseTime -commonname 'app homepage' -URL 'https://url1' -environment 'PRODUCTION'
  ResponseTime -commonname 'department homepage' -URL 'https://url2' -environment 'PRODUCTION'
  
  $results | export-csv -Path c:\so.csv -NoTypeInformation
  </code></pre>