document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. # Code Snippet from aperturescience.su
  2. # Parameters
  3.  
  4. [Parameter(Position=1, Mandatory=$false, HelpMessage="hostname(s)")]$hosts = "google.com",
  5. [Parameter(Position=2, Mandatory=$false, HelpMessage="MaxResponsetime in ms")]$MaxResponsetime = "250",
  6.  
  7. # Body:
  8.  
  9. try
  10. {
  11.     $results = Test-Connection $hosts
  12. }
  13. catch
  14. {
  15.     send-email "Error running Test-Connection, error $_" $false
  16.     exit 3
  17. }
  18.  
  19. foreach ($result in $results)
  20. {
  21.     if ($result.responsetime -gt $MaxResponsetime)
  22.     {
  23.         send-email "exceed response time limit" $false
  24.     }
  25. }
  26. send-email "Sucessful ping" $true
  27.  
  28.  
  29. # Code Snippet from aperturescience.su
');