View all Worklets
Windows

Create User Based Scheduled Task

Sets up user-based task scheduled on log-on.

Worklet Details

Introduction to the PowerShell Based Create User-Based Scheduled Task Worklet

The Create User-Based Scheduled Task Worklet is a PowerShell script that allows network administrators to easily create a scheduled task for Windows devices, targeting specific users. By utilizing this Worklet, administrators can automate routine tasks and ensure that they are executed under the context of a specific user account when they log in.

The Worklet aims to mimic Group Policy Object (GPO) functionality, making it accessible and efficient for managing multiple devices.

Why would you use the Create User-Based Scheduled Task Worklet?

Using the Create User-Based Scheduled Task Worklet can be beneficial for network administrators who need to configure tasks that require execution within the context of user accounts. Examples include tasks such as running batch files or executable files that depend on user-specific information or settings.

In comparison to manually creating scheduled tasks through Windows Task Scheduler or using command-line tools, this Worklet offers an automated and targeted approach.

Components of the Create User-Based Scheduled Task Worklet

The main components of this PowerShell-based Worklet include variables such as $action.Path and $action.Arguments which represent the command and arguments needed for the task. It also utilizes PowerShell's `task.scheduler` library, allowing easy access to manipulate existing scheduled tasks or create new ones.

The script also includes provisions for setting triggers, defining actions, and registering the task definition with proper permissions under specified user contexts.

How does the Create User-Based Scheduled Task Worklet work?

This remediation script connects to Windows' built-in Schedule Service (`Schedule.Service`) in order to create a new task with user-defined parameters such as description, triggers, actions, and settings. When a targeted user logs in, the created scheduled task will execute automatically under their account context.

Once configured with appropriate commands and arguments within `$action.Path` and `$action.Arguments`, this script creates a trigger object set at logon (9), enabling it upon user login. The script also registers the task under the specified user account and ensures it runs within their permissions.

What is the expected outcome when you use the Create User-Based Scheduled Task Worklet?

When properly configured, this Worklet allows administrators to automate tasks for specific users without requiring administrator privileges or remote access to individual computers. Upon successful execution of the script, a scheduled task will be created and set to activate when the targeted user logs into their account.

The task will then run seamlessly in the background, performing any specified actions such as running scripts or executable files.

Using the Create User-Based Scheduled Task Worklet provides a streamlined solution for network administrators seeking efficient ways to manage and automate specific tasks for individual users across multiple devices. With its easy configuration through custom variables and automated task creation process, this PowerShell script can save time and resources while ensuring consistency in managing user-specific tasks on Windows devices.

View in app

Consider Worklets your easy button

What's a Worklet?

A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

do more with worklets