Windows Task Scheduler How To Show MessageBox For All Users

Do you like this?

This article shows you how to display a reminder using Task Scheduler to all users on your domain.


In this example, I'm gonna use C# to write the custom code for the message box which will be displayed on top of all Windows application. You will find the code below. With Visual Studio, when you build your application, you can get the executable files in the Bin folder which can be triggered by Windows Task Scheduler. In order for this exe file to run, you have to provide a file BackUpWindowsFormsApplication.txt in the same folder. The exe file will read the content of the text file and display to users.

Download File: Windows Task Scheduler How To Show MessageBox For All Users

Task Scheduler Message Box All Users Step 2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BackUpWindowsFormsApplication
    class Program

        static void Main(string[] args)
            Form topmostForm = topMostForm();

            string program_directory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string msg = System.IO.File.ReadAllText(program_directory + @"\BackUpWindowsFormsApplication.txt");

            MessageBox.Show(topmostForm, msg,
                "Backup", MessageBoxButtons.OK);

        static Form topMostForm()
            Form topmostForm = new Form();
            topmostForm.Size = new System.Drawing.Size(1, 1);
            topmostForm.StartPosition = FormStartPosition.Manual;
            System.Drawing.Rectangle rect = SystemInformation.VirtualScreen;
            topmostForm.Location = new System.Drawing.Point(rect.Bottom + 10, rect.Right + 10);
            // Make this form the active form and make it TopMost
            topmostForm.TopMost = true;
            return topmostForm;

comments powered by Disqus