Advertisement
Guest User

Untitled

a guest
Dec 29th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. $Event = Get-eventlog -log application -Newest 1 -source "Windows Backup"
  2. $Status= $Event.Message
  3. $From = "email@email.com"
  4. $To = "email@email.com"
  5. $SMTPServer = "smtp"
  6. $SMTPPort = "port"
  7. $Username = "email"
  8. $Password = "***"
  9. $Subject = "$computer, $status"
  10. $Body = $event | format-list | out-string
  11. $smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort);
  12. $smtp.EnableSSL = $false
  13. $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
  14. $smtp.Send($From, $To, $subject, $body);
  15. $computer = "$env:computername"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement