title: Cannot convert argument "address", with value: "System.Object[]", for "DownloadString" to type "System.Uri": "Cannot convert the "System.Object[]"
body: <p>I need to create a script to make a request on 3 different environment urls, and then generates a CSV file with the average response time of each environment, for each page that I send.</p>
  
  <p>However I get this error:</p>
  
  <blockquote>
    <p>Cannot convert argument "address", with value: "System.Object[]", for
    "DownloadString" to type "System.Uri": "Cannot convert the
    "System.Object[]"  value of type "System.Object[]" to type
    "System.Uri".</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>function ResponseTime($CommonName,$URL, $environment) 
  { 
      $Times = 5 
      $i = 0 
      $TotalResponseTime = 0 
  
      While ($i -lt $Times) { 
          $Request = New-Object System.Net.WebClient 
          $Request.UseDefaultCredentials = $true 
          $Start = Get-Date 
          $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
  
  } 
  
  ResponseTime 'app homepage' 'https://urlproduction', 'PRODUCTION' 
  ResponseTime 'app homepage' 'https://urlQA', 'QA' 
  ResponseTime 'app homepage' 'https://urltest', 'TEST' 
  
  $results | export-csv -Path c:\so.csv -NoTypeInformation
  </code></pre>