Windows
View all Worklets
WindowsWindows

Create User Based Scheduled Task

Create user-based scheduled tasks that run at logon within user context

Worklet Details

What the scheduled task creator does

This Automox Worklet™ creates scheduled tasks on Windows endpoints that execute automatically when users log on. The Worklet uses PowerShell's Schedule.Service COM object to build task definitions with user-specific triggers and actions.

The Worklet runs the remediation script every time it executes, creating a scheduled task that runs under the context of the logged-on user. This mimics Group Policy Object (GPO) functionality without requiring domain policies, making it suitable for hybrid environments, workgroups, or scenarios where GPO cannot be applied.

You configure the action path and arguments within the Worklet variables to specify what command runs at logon. Common use cases include running setup scripts, initializing user-specific applications, or executing maintenance tasks that require user permissions.

Why automate user-based scheduled tasks

Creating user-based scheduled tasks manually across hundreds of endpoints creates configuration inconsistencies and deployment failures. Without automation, IT teams spend hours configuring tasks one endpoint at a time, introducing human errors that cause tasks to fail silently. Organizations cannot scale user-context automation when every endpoint requires manual intervention, leaving critical user-specific scripts undeployed.

User-context execution is critical for tasks that depend on user-specific data, registry keys, or application settings. Tasks running as system or administrator often lack access to user-specific resources. By running under the user account context, the task can access files, environment variables, and registry entries that exist only in the user's profile.

The Worklet maintains consistency across your infrastructure. You define the task once and deploy it to all endpoints, eliminating the risk of configuration drift or missed deployments. This reduces support overhead and improves operational efficiency.

How scheduled task creation works

  1. Evaluation phase: The evaluation script always returns non-compliant (exit code 1), verifying the remediation runs every time the Worklet executes. This allows the task to be created or updated on demand.

  2. Remediation phase: The remediation script connects to the Windows Schedule.Service COM object, creates a new task with a logon trigger (trigger type 9), configures the action with your specified command and arguments, and registers the task in the root task folder under the user account context.

Scheduled task configuration requirements

  • Windows 10, Windows 11, or Windows Server 2016 and later

  • PowerShell 2.0 or later (built-in on all supported Windows versions)

  • Administrator privileges required to register tasks in the Schedule.Service

  • Customization of $action.Path variable with the command to execute

  • Customization of $action.Arguments variable with command-line arguments

  • Unique task name (default is 'Run at user logon') to avoid conflicts with existing tasks

Expected scheduled task behavior

After remediation completes successfully, the scheduled task appears in Windows Task Scheduler under the root folder with the name you configured (default: 'Run at user logon'). The task runs automatically the next time the user logs on to the endpoint, executing your specified command or script under their user account context.

Verification: Open Task Scheduler (taskschd.msc) and navigate to the root folder to confirm the task exists. Check the task properties to verify the trigger is set to 'At log on' and the action points to your specified command. Run Get-ScheduledTask -TaskName 'Run at user logon' in PowerShell to verify task registration programmatically. Log off and log back on to test task execution. The task runs silently unless your command explicitly outputs information, maintaining minimal disruption to the user's login experience.

How to validate create user based scheduled task changes

  1. Run this Worklet on a pilot Windows endpoint and review evaluation output for create user based scheduled task.

  2. Confirm Automox activity logs show successful completion and exit code 0.

  3. Verify endpoint state using checks aligned to evaluation script logic, such as the evaluation and remediation scripts.

  4. Validate remediation effects from script operations such as New-Object, then rerun evaluation for compliance.

View in app
evalutation image
remediation image

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