title: PowerShell script to check the status of a URL
body: <p><a href="https://stackoverflow.com/questions/18500832/script-to-check-the-status-of-a-url">Similar to this question here</a> I am trying to monitor if a set of website links are up and running or not responding. I have found the same PowerShell script over the Internet.</p>
  
  <p>However, instead of direct website links I need to check more specific links, for example:</p>
  
  <pre><code>http://mypage.global/Chemical/
  
  http://maypage2:9080/portal/site/hotpot/
  </code></pre>
  
  <p>When I am trying to check on the status of these links, I get the following output:</p>
  
  <pre><code>URL    StatusCode    StatusDescription    ResponseLength    TimeTaken
  http://mypage.global/Chemical/    0
  http://maypage2:9080/portal/site/hotpot/    0
  </code></pre>
  
  <p>The above links requires me to be connected to the VPN, but I can access these links from the browser.</p>
  
  <p>Output of <code>Invoke-WebRequest -Uri https://stackoverflow.com/questions/20259251/powershell-script-to-check-the-status-of-a-url</code>:</p>
  
  <pre><code>PS C:\Users\682126&gt; Invoke-WebRequest -Uri https://stackoverflow.com/questions/20259251/powershell-script-to-check-the-status-of-a-url
  
  The term 'Invoke-WebRequest' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  
  At line:1 char:18
  + Invoke-WebRequest &lt;&lt;&lt;&lt;  -Uri https://stackoverflow.com/questions/20259251/powershell-script-to-check-the-status-of-a-url &gt; tmp.txt
      + CategoryInfo          : ObjectNotFound: (Invoke-WebRequest:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
  </code></pre>
  
  <p><code>$PSVersionTable</code></p>
  
  <pre><code>Name                           Value
  ----                           -----
  CLRVersion                     2.0.50727.5472
  BuildVersion                   6.1.7601.17514
  PSVersion                      2.0
  WSManStackVersion              2.0
  PSCompatibleVersions           {1.0, 2.0}
  SerializationVersion           1.1.0.1
  PSRemotingProtocolVersion      2.1
  </code></pre>