PowerShell script to check the status of a URL

后端 未结 6 665
不知归路
不知归路 2020-12-04 18:36

Similar to this question here 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 Interne

6条回答
  •  时光取名叫无心
    2020-12-04 19:01

    For people that have PowerShell 3 or later (i.e. Windows Server 2012+ or Windows Server 2008 R2 with the Windows Management Framework 4.0 update), you can do this one-liner instead of invoking System.Net.WebRequest:

    $statusCode = wget http://stackoverflow.com/questions/20259251/ | % {$_.StatusCode}
    

提交回复
热议问题