title: invoke-webrequest returns 401 with Windows Authentication
body: <p>I'm working on a script to login to a sharepoint 2013 site and navigate to a few pages to make sure the site is working after updates and DR drills. I'm calling Invoke-WebRequest like this:</p>
  
  <pre><code>$site = Invoke-WebRequest -uri 'https://spsite' -Credential $(Get-Credential) -SessionVariable s
  </code></pre>
  
  <p>when I make the call I get a 401 Unauthorized error back. I have tried using basic authentication and building out the headers like this: </p>
  
  <pre><code>$u = 'domain\user'
  $p = 'password'
  $header = @{ Authorization = "Basic {0}" -f [convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $u,$p))) }
  
  $site = Invoke-WebRequest -uri 'https://spsite' -Headers $header
  </code></pre>
  
  <p>with the same result. I'm hoping someone could offer another way to make this connection? </p>