Jump to content
$SmtpFrom = "YourServer <YourServer@domain.tld>"
$SmtpRecipient = "Lastname, Firstname <YourMailAddress@domain.tld>"
$SmtpServer = "your.mail.server"
$SmtpPort = 587
$SmtpSubject = "Reboot has occured"
$SmtpBody = "The machine " + $env:computername + " has rebooted."

Send-MailMessage -From $SmtpFrom -To $SmtpRecipient -SmtpServer $SmtpServer -Subject $SmtpSubject -Body $SmtpBody -Port $SmtpPort -encoding ([System.Text.Encoding]::UTF8)

Save as a .ps1, put it somewhere on the server, create a new task schedular task to run this upon boot

Link to comment
https://linustechtips.com/topic/1054747-server-notifying/#findComment-12485002
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×