locked
IIS Monitoring Script for all website pages RRS feed

  • Question

  • User2095693408 posted

    I need to setup a monitoring script/or method to test if all pages of the website are up. running Win 2016/IIS10. do you have a PS script, hyperlink or method that I can apply (I am interested in the monitoring script/part, not the scheduling)
    I consider running through Task Scheduler .

    I posted in another IIS forum but did not get a pertaining reply. I also posted on TechNet PS site but was advised to post to this IIS Configuration and Scripting site instead.


    Thank you,

    Tuesday, March 5, 2019 5:50 PM

All replies

  • User-848649084 posted

    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.

    Wednesday, March 6, 2019 7:34 AM
  • User2095693408 posted

    Hi Jalpa, the script it is in the right direction, but shows just testing for a URL and I need more complete solution, query all pages/sites under website, log results, email failures/timeouts/etc. 

    Microsoft tool would not work since it is for intranet.

    Thank you,

    Thursday, March 7, 2019 4:02 AM
  • User-848649084 posted

    Hi,

    If you want that type of script or tool you need to buy a scripting tool or write script by your self  because there is no tool provided by IIS. You could request as new feature of IIS. 

    There is another script for your reference is below:

    https://dotnet-helpers.com/powershell/powershell-script-for-website-availability-monitoring-with-excel-report-as-output/

    Regards,

    Jalpa.

    Thursday, March 7, 2019 6:58 AM