top of page

Setting up a reminder with task scheduler

Hello again friends, on this tutorial I have scripted a reminder to pop up at a certain time to remind me of "any" task, of course you have to change it as needed or customize it any way you want.

​

First you will need to create the script, I have called it "Reminder", you can name it whatever you want, also it will speak when the task executes.

​

function New-Alarm
{
    param(
        [Parameter(Mandatory=$true,HelpMessage="Enter a time in HH:MM format (e.g. 23:00)")]
        [String]
        $time,

        [Parameter(Mandatory=$true,HelpMessage="Enter the alert box title (e.g. Alert!).")]
        [String]
        $alertBoxTitle,

        [Parameter(Mandatory=$true,HelpMessage="Enter the alert message.")]
        [String]
        $alertBoxMessage
    )

    do
    {
        Start-Sleep -Seconds 1
    }
    until((get-date) -ge (get-date $time))
    # Play system sound:
    [system.media.systemsounds]::Exclamation.play()
    # Display message
    Add-Type -AssemblyName System.Windows.Forms
    Add-Type -AssemblyName PresentationFramework
    [System.Windows.Forms.MessageBox]::Show($alertBoxMessage,$alertBoxTitle)
}


Add-Type –AssemblyName System.Speech
            #Next, declare a variable which will essentially create a .NET object whose function you will call later. This just saves you some typing; consider it like a shortcut. We will call the variable $talk.
            $talk = New-Object –TypeName System.Speech.Synthesis.SpeechSynthesizer
            #Now, to get something to come out of your speakers, you just call the Speak property of your $talk .NET object.
            $talk.Speak('Good morning sir, make sure to look at your calendar, there are deployments to be made!')

New-Alarm -time "12:00" -alertBoxTitle "Alert!" -alertBoxMessage "Good morning, Hope you heard the message!"

 

Note: you need to set the alarm accordingly.

 

 

Next, create a batch file that will be called by your scheduled task, maybe there is another way but this seems to work for me and it was easy to create.

 

Create batch file:

​

@ECHO OFF

REM Powershell.exe set-executionpolicy remotesigned -File  C:\Users\SE\Desktop\ps.ps1

PowerShell.exe -executionpolicy remotesigned -File "C:\temp\Reminder.ps1"

​

save the file as .bat, make sure you know where it is.

​

Note: Make sure you set the proper execution policy for your environment, this will be a good troubleshooting test in case it does not work for you.

 

Now its time to add the task:

​

Now I am not going to explain how to add a task, there is plenty of tutorials for you to find out how. Just remember it is the schedule task that will launch the batch file which will open up the PS script. This would be a good learning tutorial for you to troubleshoot in case it does not work.

 

Send me a line and let me know how you did.
 

​

  • Facebook - Black Circle
  • Twitter - Black Circle

© 2023 by IT SERVICES.  Proudly created with Wix.com

bottom of page