We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

View Complete Thread
  • Re: IIS Monitoring Script for all website pages

    Mar 06, 2019 07:34 AM|Jalpa Panchal|LINK

    Hi HSever,

    You could use below PowerShell script to check the status of a URL:

    # We then get a response from the site.
    $HTTP_Response = $HTTP_Request.GetResponse()
    
    # We then get the HTTP code as an integer.
    $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!"
    }
    
    # Finally, we clean up the http request by closing it.
    $HTTP_Response.Close()
    

    Or you could use Microsoft tool to Monitor availability and responsiveness of any web site:

    https://docs.microsoft.com/en-us/azure/azure-monitor/app/monitor-web-app-availability#setup

    Regards,

    Jalpa.

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.