Task Scheduler enables you to automatically perform routine tasks on a chosen computer. Task Scheduler does this by monitoring whatever criteria you choose. This is referred to as “triggers” and then executing the tasks when those criteria are met. You can use the Task Scheduler to execute tasks such as starting an application, sending an email message, etc. Tasks can be scheduled to execute in response to these events, or triggers. Here are some related articles on Windows Task Scheduler: How to create an advanced scheduled task on Windows Server with Windows Task Scheduler, how to export and import scheduled tasks on Windows Server with the Task scheduler and PowerShell, how to run, edit, and delete a task using Task Scheduler GUI (taskschd.msc), how to automate Windows Update with PowerShell and Task Scheduler, and how to create a scheduled task with Windows Admin Center.
An email notification is an email sent to inform your subscribers about changes or updates to a website or service. Email and push notifications are both powerful ways by which you can deliver your message to your users.
All you need to do is modify the from address, to address, and the SMTP address. You may want to see how to configure SMTP on a Windows server.
$From = "techdarchiveDC@techdirectarchive.com" $To = "firstname.lastname@example.org" $Subject = "techdarchiveDC Backup SUCCESSFUL" $Body = "techdarchiveDC backup successful. No further action is required" $SMTPServer = "smtp.xxxxxxx.com" $SMTPPort = "25" Send-MailMessage -From $From -to $To -Subject $Subject -Body $Body -SmtpServer $SMTPServer -port $SMTPPort
Ensure you save this file with the PowerShell extension “.ps1”
Setup Scheduled Task: From the Start menu, select Administrative Tools and then Task Scheduler.
This will open up the task scheduler Tool, right-click on Task Scheduler or “under Actions”
– Select “Create Task”
This will open up the create task dialog window as shown below. On the General Tab, Enter the Task Name
– Enter a description for others to understand what you are doing
– Select “run with the highest privilege”
Navigate to the Trigger Tab as shown below. Click on New, This will open a window where the trigger can be defined.
On the Actions window, click on
New and enter the following.
– Program/script: C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe
– Argument is path to script: C:\Users\Christian\Documents\Emailbackupalert.ps1
– Click Ok. The setup is complete because we do not need to set conditions and settings.
To test this task, since the date we have configured this task to run is still in the future, we will manually run the task as shown below. For more information on how to run, edit, and delete a task using Task Scheduler GUI (
taskschd.msc), see the following link.
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.