Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Code Snippet from aperturescience.su
- # Parameters
- [Parameter(Position=1, Mandatory=$false, HelpMessage="hostname(s)")]$hosts = "google.com",
- [Parameter(Position=2, Mandatory=$false, HelpMessage="MaxResponsetime in ms")]$MaxResponsetime = "250",
- # Body:
- try
- {
- $results = Test-Connection $hosts
- }
- catch
- {
- send-email "Error running Test-Connection, error $_" $false
- exit 3
- }
- foreach ($result in $results)
- {
- if ($result.responsetime -gt $MaxResponsetime)
- {
- send-email "exceed response time limit" $false
- }
- }
- send-email "Sucessful ping" $true
- # Code Snippet from aperturescience.su
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement