Documentation
¶
Index ¶
- Constants
- func Install(exec executor.Executor, log *progress.Logger, maxExec time.Duration) error
- func IsTaskRegistered(ctx context.Context, exec executor.Executor) bool
- func ReconcileTaskSettings(exec executor.Executor, log *progress.Logger, maxExec time.Duration) (perSession, registered bool)
- func RunNow(exec executor.Executor, log *progress.Logger) error
- func Uninstall(exec executor.Executor, log *progress.Logger) error
Constants ¶
const TaskName = taskName
TaskName is the Windows scheduled task name. Exported so other packages (e.g. schedinfo) can query the task without re-deriving the constant.
const UpdateTaskName = updateTaskName
UpdateTaskName is exported for diagnostics (schedinfo-style queries).
Variables ¶
This section is empty.
Functions ¶
func Install ¶
Install configures Windows Task Scheduler for periodic scanning. If already installed, upgrades by removing and re-creating the task. maxExec is the agent's execution-watchdog duration (0 = disabled); the task's ExecutionTimeLimit is derived from it.
func IsTaskRegistered ¶ added in v1.11.4
IsTaskRegistered reports whether the Windows scheduled task created by `dev-machine-guard install` is currently registered. Used by the telemetry package's invocation detector to distinguish a manual CLI run from a scheduler-triggered one. Any error or non-zero schtasks exit is treated as "not registered" so a transient Schedule-service hiccup degrades to "one_time" rather than erroring the run.
func ReconcileTaskSettings ¶ added in v1.19.0
func ReconcileTaskSettings(exec executor.Executor, log *progress.Logger, maxExec time.Duration) (perSession, registered bool)
ReconcileTaskSettings re-applies the scan tasks' settings to whatever is registered now: power and retry settings, the execution limit and, on a host that scans per session, MultipleInstancesPolicy=Parallel. The policy is decided at install time from what the host is then, but a host turns shared later (the sticky marker, a second established developer) and a self-update swaps binaries without touching the tasks, so such a host would keep IgnoreNew and drop a second session's scan while the first still runs. The SYSTEM updater calls this on every tick. Reports whether the host scans per session and whether the tasks were registered at all (a loader install or no install is a no-op).
func RunNow ¶ added in v1.11.7
RunNow asks Task Scheduler to fire the registered task immediately, using its configured principal (/ru INTERACTIVE for admin installs). Used by the install flow under LocalSystem to surface first-run telemetry under the logged-in user rather than scanning SYSTEM's empty profile inline.
schtasks /run returns 0 once the scheduler has accepted the request; it does not wait for the task to complete and does not report whether an interactive session exists. If no user is logged in, the trigger silently no-ops and the task fires on its next hourly tick.
Types ¶
This section is empty.