locked
How can I query a https website used to display the status of an application using Powershell? RRS feed

  • Frage

  • Need assistance on querying the status of an application using Powershell. The status of the application is displayed in a https website. I want to receive a notification when one of the listed applications fails.

    Below is an example the failures I need to capture.

    h-t-t-p-::://xpps2.xxcom/ssol/sSOLStatus.asp?autorun

    SSOL Status

    Current App Server: xpps2.xx.com

    SQL Server Details: 

    SSS_MyAccount DB Connection: PASS

    SSS_MyAccount DB Query: PASS

    CAGWEB DB Connection: FAIL - Unable to Connect

    CAGWEB DB Query: FAIL - Pay location not found

    DB2 Server Details:

    DB2 D Connection: PASS

    DB2 Q Query: FAIL -Acct not found

    DB2 X Query: PASS

    DB2 N Query: PASS

    DB2 S Query: PASS

    DB2 K Query: PASS

    DB2 I Query: PASS

    Mitem Server Details:

    MITEM server: MITEMP2

    MITEM Total Devices: 10

    MITEM Devices Lines Up: 10

    MITEM Devices Logged In: 10

    MITEM Devices In Use: 0

    Mitem Server Status: PASS

    Web Service Details:

    SAW Web Service Status: FAIL

     


    Maximo Vizcaino


    • Bearbeitet mxvizcaino Freitag, 31. Januar 2014 15:18
    Freitag, 31. Januar 2014 15:15

Antworten

  • thats where you are going to check what it is supposed to be.

    lets say your page shows as SSOL Status : running  you probably want to use "if($totalstrng.ToLower().contains("ssqlL status : running"))". its checking if the html page contains the string you are looking for.

    you might want to print $totalstrng and see what you need to look for.

    usign XMLHttp or XML object  as mentioned by JRV might be easier and faster way.

    • Als Antwort markiert mxvizcaino Dienstag, 4. Februar 2014 22:25
    Freitag, 31. Januar 2014 20:06

Alle Antworten

  • Unless your web site is designed to give you the app status you cannot get it by querying the web site.

    Ask you web provider if they have tools to check the application status.

    try:  http://www.iis.net


    ¯\_(ツ)_/¯

    Freitag, 31. Januar 2014 15:25
  • can you try this?

    $userAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"
    $wc = New-Object System.Net.WebClient
    $wc.Headers.Add("user-agent", $userAgent)

    $statuscheck = "https:://xpps2.xxcom/ssol/sSOLStatus.asp?autorun"

    try{
    $totalstrng = $wc.DownloadString($statuscheck)
    if($totalstrng.ToLower().contains("success")){
    #success
    }

    else{

    #failed
    }
    }
    catch{
    Write-Warning "$($error[0])" 
    }

    Freitag, 31. Januar 2014 15:32
  • If you are just trying to capture a web page then vamsimn has posted code that grabs a web page.  You can easily load this into a XMLHttp or XML object and query the table by name.


    ¯\_(ツ)_/¯

    Freitag, 31. Januar 2014 16:13
  • It looks promising.
    Can you explain this line: "if($totalstrng.ToLower().contains("success"))"?

    Maximo Vizcaino


    • Bearbeitet mxvizcaino Freitag, 31. Januar 2014 19:31
    Freitag, 31. Januar 2014 19:31
  • thats where you are going to check what it is supposed to be.

    lets say your page shows as SSOL Status : running  you probably want to use "if($totalstrng.ToLower().contains("ssqlL status : running"))". its checking if the html page contains the string you are looking for.

    you might want to print $totalstrng and see what you need to look for.

    usign XMLHttp or XML object  as mentioned by JRV might be easier and faster way.

    • Als Antwort markiert mxvizcaino Dienstag, 4. Februar 2014 22:25
    Freitag, 31. Januar 2014 20:06
  • Thanks @vamsim. This is the guidance I was looking for.


    Maximo Vizcaino

    Dienstag, 4. Februar 2014 22:26