WindowsTaskSchedulerClient class

Namespace Runic.Platform.Administration.Windows.Tasks in Runic.Platform.Administration.Windows 0.23.0

public sealed class WindowsTaskSchedulerClient

Task Scheduler operations using the current Windows identity on an explicit local or remote computer.

Constructors

WindowsTaskSchedulerClient

public WindowsTaskSchedulerClient(string? machineName = null)

Creates a client. Null selects the local computer; native bindings currently require Windows x64.

Methods

CreateAsync

public Task<ScheduledTaskSnapshot> CreateAsync(string path, ScheduledTaskSpecification specification, string? password = null, CancellationToken cancellationToken = default)

Creates a task from a typed definition. Passwords are used only during registration.

CreateFolderAsync

public Task CreateFolderAsync(string folderPath, CancellationToken cancellationToken = default)

Creates a folder with inherited security; an existing folder is a conflict.

DeleteAsync

public Task<bool> DeleteAsync(string path, CancellationToken cancellationToken = default)

Deletes a registered task. Returns false only if absent.

DeleteFolderAsync

public Task<bool> DeleteFolderAsync(string folderPath, CancellationToken cancellationToken = default)

Deletes an empty folder. Returns false only if absent.

EnumerateAsync

public Task<ImmutableArray<ScheduledTaskSnapshot>> EnumerateAsync(string folderPath = "\\", CancellationToken cancellationToken = default)

Enumerates tasks directly inside a folder, including hidden tasks.

EnumerateFoldersAsync

public Task<ImmutableArray<string>> EnumerateFoldersAsync(string folderPath = "\\", CancellationToken cancellationToken = default)

Enumerates immediate child folder paths.

FindAsync

public Task<ScheduledTaskSnapshot?> FindAsync(string path, CancellationToken cancellationToken = default)

Reads a task including its complete XML. Null means absent.

RegisterXmlAsync

public Task<ScheduledTaskSnapshot> RegisterXmlAsync(string path, string xml, bool replaceExisting = false, string? password = null, CancellationToken cancellationToken = default)

Registers complete native XML. replaceExisting opts into create-or-update, without deleting the existing task.

RunAsync

public Task<RunningTaskSnapshot> RunAsync(string path, CancellationToken cancellationToken = default)

Requests execution and returns its instance identity and current state, not an execution-success claim.

SetEnabledAsync

public Task SetEnabledAsync(string path, bool enabled, CancellationToken cancellationToken = default)

Changes enabled state without rewriting the task definition.

StopAsync

public Task StopAsync(string path, CancellationToken cancellationToken = default)

Requests that all running instances of a registered task stop.

UpdateAsync

public Task<ScheduledTaskSnapshot> UpdateAsync(string path, ScheduledTaskUpdate update, string? password = null, CancellationToken cancellationToken = default)

Updates selected XML subtrees, preserving all unmodified native settings. Missing tasks fail.

ValidateAsync

public Task ValidateAsync(ScheduledTaskSpecification specification, CancellationToken cancellationToken = default)

Validates typed task XML through Windows without registering a task or changing machine state.

ValidateXmlAsync

public Task ValidateXmlAsync(string xml, CancellationToken cancellationToken = default)

Validates native task XML without registration. Account credentials and runtime permissions are not validated.