Reference · reference

service module (Windows)

1 min read · 2026-09-02 · config-weave 0.1.0

use service manages Windows services through the Service Control Manager. It is Windows-only in this version: manage Linux services by running systemctl through the shell module. The module is registered on every platform so a playbook compiles and validates identically everywhere; on Linux and macOS every call returns a runtime error. Every function takes the service name and returns Result[…, string].

status

rust
service::status(name: string) -> Result[string, string]

The current state of a service: running, stopped, start_pending, stop_pending, paused, pause_pending or continue_pending. A state the module does not recognise is reported as unknown.

start and stop

rust
service::start(name: string) -> Result[unit, string]
service::stop(name: string) -> Result[unit, string]

Starts or stops a service. Each is a no-op when the service is already in the target state.

set_startup and startup

rust
service::set_startup(name: string, mode: string) -> Result[unit, string]
service::startup(name: string) -> Result[string, string]

set_startup sets the startup type to automatic, manual or disabled. startup reads it back; a type outside those three is reported as other.

rust
use service
use value

fn apply(props: Value) -> Result[ApplyResult, string] {
    service::set_startup("Spooler", "disabled")?
    service::stop("Spooler")?
    Ok(ApplyResult::Success)
}