title: Downloading files with powershell 2.0 on windows 7
body: <p>Here's my script to download the file, im replacing the url to download from because it's a private cloud site, i've searched everywhere and they all say that this is the right way to download in older versions of PS but i keep getting the error </p>
  
  <blockquote>
    <p><code>Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request." At line:60 char:25    +     $client.DownloadFile &lt;&lt;&lt;&lt; ($url, $targetFile)     + CategoryInfo     : NotSpecified: (:) [], MethodInvocationException    + FullyQualifiedErrorId : DotNetMethodException</code></p>
  </blockquote>
  
  <pre><code>$url = "(download url)" 
  $path = "C:\temp\jre-7u71-windows-i586.exe" 
  # param([string]$url, [string]$path) 
  
  if(!(Split-Path -parent $path) -or !(Test-Path -pathType Container (Split-Path -parent $path))) { 
    $targetFile = Join-Path $pwd (Split-Path -leaf $path) 
  } 
  
  "Downloading [$url]`nSaving at [$path]" 
  $client = new-object System.Net.WebClient 
  $client.DownloadFile($url, $targetFile) 
  #$client.DownloadData($url, $targetFile) 
  
  $path
  </code></pre>