TestimoX

API Reference

Command

Set-CxScheduledTask

Namespace ComputerX.PowerShell
Outputs
ComputerX.ScheduledTasks.ScheduledTaskInfo System.Boolean

Creates, updates, enables, disables, removes, or starts a Scheduled Task.

Examples

Authored help example

Example 1


Set-CxScheduledTask -Path "\TestimoX\Collector" -Enable
        

Example 2


Set-CxScheduledTask -Path "\TestimoX\Collector" -RunNow
        

Example 3


Set-CxScheduledTask -Path "\TestimoX\Collector" -Command "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -Arguments "-File C:\\Scripts\\Collect.ps1" -TriggerKind AtStartup -RunElevated
        

Example 4


# Update principal to SYSTEM
            Set-CxScheduledTask -Path "\Ops\Rotate" -RunAsUser 'SYSTEM' -RunElevated
        

Example 5


# Update principal to gMSA (auto ServiceAccount)
            Set-CxScheduledTask -Path "\Ops\Sync" -RunAsUser 'CONTOSO\\svc-sync$'
        

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Set-CxScheduledTask -Path <string> [-Arguments <string>] [-Command <string>] [-ComputerName <string>] [-Credential <PSCredential>] [-Description <string>] [-IncludeLolBins] [-Interval <TimeSpan>] [-LogonType <string>] [-RunAsUser <string>] [-RunElevated] [-StartBoundary <DateTime>] [-Suspicious] [-TriggerKind <Once|Daily|AtStartup|AtLogon>] [-WorkingDirectory <string>] [<CommonParameters>]
#
Parameter set: By Arguments + Command

Parameters

Path string requiredposition: 0pipeline: false
Full task path (e.g., \MyTasks\Example).
Arguments string optionalposition: namedpipeline: false
Optional arguments.
Command string optionalposition: namedpipeline: false
Executable to run.
ComputerName string optionalposition: namedpipeline: false
Target computer (omit or '.' for local).
Credential PSCredential optionalposition: namedpipeline: false
Credential for remote connections.
Description string optionalposition: namedpipeline: false
Optional description.
IncludeLolBins SwitchParameter optionalposition: namedpipeline: false
When -Suspicious is used, include LOLBIN heuristics in scoring.
Interval TimeSpan optionalposition: namedpipeline: false
Repeat interval for Daily triggers.
LogonType string optionalposition: namedpipeline: false
Optional logon type hint (Password, S4U, ServiceAccount).
RunAsUser string optionalposition: namedpipeline: false
User to run as (e.g., SYSTEM, NT AUTHORITY\SYSTEM, DOMAIN\User, or gMSA DOMAIN\name$).
RunElevated SwitchParameter optionalposition: namedpipeline: false
Run with highest privileges.
StartBoundary DateTime optionalposition: namedpipeline: false
Start time for Once/Daily triggers.
Suspicious SwitchParameter optionalposition: namedpipeline: false
When set (Update set), returns the updated task enriched with suspicion fields.
TriggerKind TriggerKind optionalposition: namedpipeline: falsevalues: 4
Trigger kind (Once, Daily, AtStartup, AtLogon). Optional. Possible values: Once, Daily, AtStartup, AtLogon
Possible values: Once, Daily, AtStartup, AtLogon
WorkingDirectory string optionalposition: namedpipeline: false
Optional working directory.

Outputs

ComputerX.ScheduledTasks.ScheduledTaskInfo, System.Boolean

Set-CxScheduledTask -Path <string> -Enable [-ComputerName <string>] [-Credential <PSCredential>] [<CommonParameters>]
#
Parameter set: By Enable

Parameters

Path string requiredposition: 0pipeline: false
Full task path (e.g., \MyTasks\Example).
Enable SwitchParameter requiredposition: namedpipeline: false
Enable the task.
ComputerName string optionalposition: namedpipeline: false
Target computer (omit or '.' for local).
Credential PSCredential optionalposition: namedpipeline: false
Credential for remote connections.

Outputs

ComputerX.ScheduledTasks.ScheduledTaskInfo, System.Boolean

Set-CxScheduledTask -Path <string> -Disable [-ComputerName <string>] [-Credential <PSCredential>] [<CommonParameters>]
#
Parameter set: By Disable

Parameters

Path string requiredposition: 0pipeline: false
Full task path (e.g., \MyTasks\Example).
Disable SwitchParameter requiredposition: namedpipeline: false
Disable the task.
ComputerName string optionalposition: namedpipeline: false
Target computer (omit or '.' for local).
Credential PSCredential optionalposition: namedpipeline: false
Credential for remote connections.

Outputs

ComputerX.ScheduledTasks.ScheduledTaskInfo, System.Boolean

Set-CxScheduledTask -Path <string> -Remove [-ComputerName <string>] [-Credential <PSCredential>] [<CommonParameters>]
#
Parameter set: By Remove

Parameters

Path string requiredposition: 0pipeline: false
Full task path (e.g., \MyTasks\Example).
Remove SwitchParameter requiredposition: namedpipeline: false
Remove the task.
ComputerName string optionalposition: namedpipeline: false
Target computer (omit or '.' for local).
Credential PSCredential optionalposition: namedpipeline: false
Credential for remote connections.

Outputs

ComputerX.ScheduledTasks.ScheduledTaskInfo, System.Boolean

Set-CxScheduledTask -Path <string> -RunNow [-ComputerName <string>] [-Credential <PSCredential>] [<CommonParameters>]
#
Parameter set: By RunNow

Parameters

Path string requiredposition: 0pipeline: false
Full task path (e.g., \MyTasks\Example).
RunNow SwitchParameter requiredposition: namedpipeline: false
Start the task now.
ComputerName string optionalposition: namedpipeline: false
Target computer (omit or '.' for local).
Credential PSCredential optionalposition: namedpipeline: false
Credential for remote connections.

Outputs

ComputerX.ScheduledTasks.ScheduledTaskInfo, System.Boolean