Introduction: A quick script to watch a website to see if it remains online. Checks every five seconds. This is different than doing a simple ping check as it actually takes a look at the site and returns a status code. This is especially useful if you want to make sure a site is up during a critical event.
while ($true -eq $true) {curl DOMAIN_NAME.COM | findstr "RawContent"; sleep 5}
Or
while ($true -eq $true) {curl DOMAIN_NAME.COM | findstr "StatusCode"; sleep 5}
To see everything you can filter for, run this ‘curl’ command against the domain in question.
curl DOMAIN_NAME.COM
UPDATE: A YouTube commenter (Peronnik Beijer) provided the following script that is much more simple.
while ($true) { curl google.com | select "statuscode"; sleep 3}
Reference: Wiki: List of HTTP status codes