Run an ad-hoc script on a device
Run an ad-hoc script on the device for the given device ID.
The script content is sent inline (there is no script catalog) and runs on the device via FleetDM the next time it is online.
Supported platforms: macOS (bash/zsh), Windows (PowerShell), Linux (bash)
Asynchronous: the response returns immediately with status: "pending". Poll the device’s run history to read output, exitCode and runtime once the device reports back.
⚠️ Warning: this executes arbitrary code on the device with elevated privileges. Review the script before running it.
Not supported: iOS, Android, Chrome OS
Authorizations
Use your Primo API key in the Authorization header as Bearer <API_KEY>.
Path Parameters
Body
The shell (bash/zsh) or PowerShell script to run on the device. Sent inline and executed via FleetDM.
1 - 10000Response
Identifier of the script run record.
FleetDM execution id for this run.
The script content that was executed.
Run status. pending until the device reports back, then completed/errored/timeout.
pending, completed, errored, timeout Combined stdout/stderr once the run completes. Null while pending.
Process exit code once the run completes. Null while pending.
Run duration in seconds once the run completes. Null while pending.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$