A PowerShell utility for managing a Windows Scheduled Task that launches and controls a wpm daemon/service.
If you are not familiar with wpm by LGUG2Z, check that out first. It is a simple user process management for Windows.
Think of it as an incredibly minimal alternative to systemd in Windows. Are you annoyed by having simple scripts/portable appliations being started by one of 9,000,000 possible arbitrary places in Windows? These are perfect for WPM to handle.
Windows Task Scheduler starts wpmd, wpmd starts everything else.
It's magic.
This tool makes it a tiny bit more magical.
- Loads all configuration from a single JSON file (
wpmdctl.json) - Supports environment variable expansion in config values
- Robust error handling and clear CLI usage
- Requires PowerShell 7.2+
-
Copy wpmdctl.ps1 into your $env:Path somewhere!
-
Copy the configuration file:
Place your
wpmdctl.jsonfile in the configuration directory. By default, the script will look for the config file at:$env:WPMDCTL_CONFIG_HOME\wpmdctl.jsonIf the environment variable
WPMDCTL_CONFIG_HOMEis not set, it will default to:$env:USERPROFILE\.config\wpmdctl\wpmdctl.json -
Edit your configuration:
See
wpmdctl.example.jsonfor a template. Example:{ "wpm_instances": [ { "TaskName": "wpmd", "TaskPath": "\\", "Command": "C:\\Windows\\System32\\conhost.exe", "Arguments": "--headless $env:USERPROFILE\\.cargo\\bin\\wpmd.exe $env:USERPROFILE\\.config\\wpm\\", "WorkingDir": "$env:USERPROFILE\\.config\\wpm\\", "StartAsAdmin": false } ] }Note: Only one instance is currently supported. If more than one is defined, the script will abort.
-
Run the script:
Usage: wpmdctl [-ConfigHome <PathToConfig>] [-TaskName <TaskName>] <Action> [SubCommand]
Config Parameters:
-ConfigHome - Path to directory containing wpmdctl.json (Alterntively set environment variable WPMDCTL_CONFIG_HOME)
-TaskName - Name of Task to Manage (Alternatively set environment varible WPMDCTL_TASK_NAME)
- TaskName MUST be specified if more than one wpmd instance is defined in wpmdctl.json
Available Actions:
create - Creates the scheduled task 'wpmd'
destroy - Removes the scheduled task 'wpmd'
state - Shows the registration and current status of the task 'wpmd' (including the raw output of 'wpmctl state' if the task is running)
start - Starts the scheduled task 'wpmd' (same as 'start task')
start task - Starts the scheduled task 'wpmd'
start watch - Starts the scheduled task 'wpmd' and waits for it to become ready by streaming 'wpmctl log'
start services-all - Starts all non-Oneshot wpm services that are not running
start services-auto - Starts wpm services configured for auto-start
start all - Starts the scheduled task 'wpmd' and then all non-Oneshot wpm services
stop - Stops the scheduled task 'wpmd' (same as 'stop task')
stop task - Stops the scheduled task 'wpmd'
stop services - Stops all running wpm services
stop all - Stops all running wpm services and then the scheduled task 'wpmd'
- PowerShell 7.2 or later
wpmctlmust be installed and available in yourPATH
MIT License. See LICENSE for details.
Note: This project is under active development. Multi-instance support is not yet available.
