title: How to login to website with basic authentication using Powershell
body: <p>I am trying to use PowerShell to log into a website and download a file.</p>
  
  <p>However I can't get PS to pass the credentials properly.</p>
  
  <p>Here is my PS:</p>
  
  <pre><code>$webclient = new-object System.Net.WebClient
  $webclient.Credentials = new-object System.Net.NetworkCredential("username","password","domain")
  $webpage = $webclient.DownloadString("url goes here")
  </code></pre>
  
  <p>Here is the log in box I get when I hit the site in IE:
  <img src="https://i.stack.imgur.com/bXuhP.png" alt="enter image description here"></p>