update scripts

This commit is contained in:
Alex Kup 2023-10-03 22:02:33 +03:00 committed by GitHub
parent 566cebdc96
commit a5a3637b5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 6289 additions and 5805 deletions

View file

@ -0,0 +1,22 @@
$Username = "support@domain.local";
$Password = "password";
$SendTo = "admin@domain.ru";
$MailServer = "mail.domain.ru";
$HostName = $args[0];
$IPAddress = $args[1];
$PingStatus = $args[2];
$FailedOn = $args[3];
$message = new-object Net.Mail.MailMessage;
$message.From = $Username;
$message.To.Add($SendTo);
$message.Subject = "Ping Info View";
$message.Body = "Failed ping: `r`nHost Name: $HostName`r`nIP Address: $IPAddress`r`nPing Status: $PingStatus`r`nPing Time: $FailedOn";
$smtp = new-object Net.Mail.SmtpClient($MailServer, "25");
$smtp.EnableSSL = $true;
$smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
$smtp.send($message);
# F9 - Advanced Options - Execute the following command on failed ping:
# Powershell.exe -executionpolicy remotesigned -File С:\Send-Message-PIV.ps1 "%HostName%" "%IPAddress%" "%LastPingStatus%" "%LastFailedOn%"