title: " The remote server returned an error: (401) Unauthorized "
body: <p>I am trying to verify if my URLs get a response. 
  in other words, i am trying to check if the authentication has succeeded approaching the site.</p>
  
  <p>I used:</p>
  
  
  
  <pre class="lang-powershell prettyprint-override"><code>$HTTP_Request = [System.Net.WebRequest]::Create('http://example.com')
  $HTTP_Response = $HTTP_Request.GetResponse()
  $HTTP_Status = [int]$HTTP_Response.StatusCode
  
  If ($HTTP_Status -eq 200) { 
      Write-Host "Site is OK!" 
  } Else {
      Write-Host "The Site may be down, please check!"
  }
  
  $HTTP_Response.Close()
  </code></pre>
  
  <p>and I got the response:</p>
  
  <blockquote>
    <p>The remote server returned an error: (401) Unauthorized.</p>
  </blockquote>
  
  <p>but after that i got:</p>
  
  <blockquote>
    <p>site is ok</p>
  </blockquote>
  
  <p>Does that mean it's ok? If not, what is wrong?</p>