Skip to main content
All Collectionsitopia WorkAnywhere Help LibraryCustomizations
Creating Server Shutdown Message Through Task Scheduler
Creating Server Shutdown Message Through Task Scheduler

Setting up a task to notify active users before the Server uptime schedule powers off a server

Reisbel Machado avatar
Written by Reisbel Machado
Updated over 5 years ago

The below guide explains how to create an automated Windows message to notify users before itopia's Server uptime schedule turns off a server.
The below process should be followed on each session host server that is part of an Uptime Schedule.

Log in to the server as administrator, this is pre-configured in the RDP file you can download in Instances module of itopia CAS.

First create a Script through Powershell with the following parameters and save it in your desired location.

The Output of the message currently shows the user that created the script, but this will change once it is configured through Task Scheduler. 

$Message = "IMPORTANT!!
The server will be shutting down in 10 minutes. Please save your work and logoff."
msg * /server:localhost $message

The above message can be modified to your standards.

Once you have tested the script, it is our recommendation to create one to be applied 5 minutes, and 3 minutes before the server shuts down.


Open Task Scheduler

Click Create Task

Name your Task (i.e. Server Shutdown)
Use SYSTEM as the user account.

(click the image to enlarge)

Select the Triggers tab to setup the time 

Please note that all Google servers are in UTC Time zone. You will need to review your Server uptime schedule to make the correct time conversion for your message configuration.

(click the image below to enlarge)

Go to Actions tab, here you will select the program and the location of the PS1 file.
Program: powershell.exe
Argument: -noprofile -executionpolicy bypass -file "c:\script\Server Shutdown Message.ps1"

(click the image to enlarge)

Once you have completed the instructions, please run it to test.

Did this answer your question?