Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $service = Get-Service "VSS" if ($Service.Status -ne "Running")
- { $Body ="$($service.DisplayName) is not running Please start it." }
- else { $Body = "$($service.DisplayName) is running Everything is Cool."}
- $From = "email"
- $To = "emails"
- $SMTPServer = "smtp"
- $SMTPPort = "587"
- $Username = "email"
- $Password = "password"
- $Body =$body
- $Subject = "$computer$ status"
- $smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort);
- $smtp.EnableSSL = $false
- $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
- $smtp.Send($From, $To, $subject, $body);
- $computer = $env:computername
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement