Advertisement
Guest User

Untitled

a guest
Mar 17th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. $service = Get-Service "VSS" if ($Service.Status -ne "Running")
  2. { $Body ="$($service.DisplayName) is not running Please start it." }
  3. else { $Body = "$($service.DisplayName) is running Everything is Cool."}
  4.  
  5. $From = "email"
  6. $To = "emails"
  7. $SMTPServer = "smtp"
  8. $SMTPPort = "587"
  9. $Username = "email"
  10. $Password = "password"
  11. $Body =$body
  12. $Subject = "$computer$ status"
  13. $smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort);
  14. $smtp.EnableSSL = $false
  15. $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
  16. $smtp.Send($From, $To, $subject, $body);
  17. $computer = $env:computername
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement