Quicklinks
NOTE: ActiveXperts Network Monitor ships with a large collection of PowerShell scripts to monitor any aspect of your network. Most PowerShell scripts also have a VBScript implementation. Download Now »
You can use any of the Powershell programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.
################################################################################# # ActiveXperts Network Monitor PowerShell script, © ActiveXperts Software B.V. # For more information about ActiveXperts Network Monitor, visit the ActiveXperts # Network Monitor web site at http://www.activexperts.com ################################################################################# # Script # WebSite.ps1 # Description: # Read data from a web page and search for a predefined pattern. # This function uses the ActiveSocket Toolkit, an ActiveXperts product. # ActiveSocket is automatically licensed when ActiveXperts Network Monitor is purchased # For more information about ActiveSocket, see: www.activexperts.com/network-component # Parameters: # 1) strURL - URL of the web site, without http or https prefix # 2) strPattern - Text pattern to search for in the specified site # Usage: # .\WebSite "" " " # Sample: # .\WebSite "www.activexperts.com:80/network-monitor/demopage" "Welcome to ActiveXperts Demo Page" ################################################################################# # Parameters param ( [string]$strUrl, [string]$strPattern ) cls # Checks if the parameters are ok if( [string]$strUrl -eq "" -or [string]$strPattern -eq "" -or $numMaxCpuUsage -eq "" ) { $res = "UNCERTAIN: Invalid number of parameters - Usage: .\WebSite.ps1 " echo $res exit } # The script $objHttp = new-object -comobject ActiveXperts.Http $objHttp.Connect( $strUrl ) if( $objHttp.LastError -ne 0 ) { return "UNCERTAIN: Web site is unavailable" exit } $strData = $objHttp.ReadData() if( $objHttp.LastError -ne 0 ) { return "UNCERTAIN: No response received from remote server" $objHttp.Disconnect() exit } if( $strData -Contains $strPattern -eq 0 ) { return "SUCCESS: Web site is available, text pattern found DATA: 1" } else { return "ERROR: Web site is available, text pattern not found DATA: 0" } $objHttp.Disconnect()