How to schedule a script and setup email notification via Task scheduler or any other way?

Mytoast Admin 115 Reputation points
2024-04-27T07:12:30.42+00:00

How to schedule a script and setup email notification via Task scheduler or any other way?

As I have gone through some blogs and online links but its shows traditional ways and seems "Email Send" option is deprecated in Task Scheduler.

See below snap

User's image

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,678 questions
Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
4,778 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,253 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,091 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Russell dyas 75 Reputation points
    2024-04-27T12:45:45.5133333+00:00

    Hello

    As send-mailmessage is not recommended in powershell anymore you could use a third party like Mail Slurp. Then run the PowerShell script using task scheduler

    1. https://www.mailslurp.com/blog/powershell-send-email/
    2. https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.4
    3. https://sid-500.com/2022/08/17/how-to-include-your-powershell-7-scripts-in-task-scheduler/

    Hope this helps.

    Russell

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.