Configure startup and shutdown triggers for scripted tasks
As an administrator, you might want to perform system-level tasks such as configuration or cleanup tasks when the operating system starts or shuts down.
Workspace Environment Management (WEM) provides you with machine startup and shutdown triggers that you can associate with scripted tasks. The tasks are triggered to run when the operating system starts or shuts down.
A general workflow to achieve the goal is as follows:
-
Add scripted tasks
-
Associate startup and shutdown triggers with scripted tasks
-
View task execution reports
Prerequisites
Before you start, make sure that:
-
Fast startup is turned off for the target machines. Example: for Windows 10 machines, go to Control Panel > All Control Panel Items > Power Options > System Settings and disable the Turn on fast startup option. The option affects only startup processing.
-
The scripted tasks are signed with trusted certificates and the certificates are installed on the target machines.
Recommendation
We recommend that you sign the scripted tasks with trusted certificates.
Add scripted tasks
The following information is supplemental to the guidance in Scripted Tasks. Follow the general guidance in that article and mind the details below.
This example adds two scripted tasks:
- Task 1:
startupscript
- Includes scripts to run on startup. - Task 2:
shutdownscript
- Includes scripts to run on shutdown.
Tip:
You can combine the two scripts into one so that you just need to add a single task.
-
In Web Console > Scripted Tasks, first add the
startupscript
task as follows:In this example:
- For File type, select PowerShell.
- Browse to the PowerShell file to upload it.
- For Grant permissions, select Full access.
-
Repeat step 1 to add the
shutdownscript
task.
Associate startup and shutdown triggers with scripted tasks
The following information is supplemental to the guidance in Scripted Task Settings. Follow the general guidance in that article and mind the details below.
Go to the relevant configuration set, navigate to Scripted Tasks Settings, and configure the two tasks as follows:
-
In Triggers, select Machine startup for the
startupscript
task and select Machine shutdown for theshutdownscript
task.
For your changes to take effect immediately, go to Monitoring > Administration > Agents and select Refresh agent host settings.
View task execution reports
After the tasks run successfully, you can view the results by checking the reports. For more information, see Reports. In this example, you can see the following two reports: One for shutdown and the other for startup.