Spaces method and path for this operation:
post /s/{space_id}/api/endpoint/action/runscript
Refer to Spaces for more information.
Run a script on a host. Currently supported only for some agent types.
Body
Required
-
List of agent types to retrieve. Defaults to
endpoint.Values are
endpoint,sentinel_one,crowdstrike, ormicrosoft_defender_endpoint. -
If this action is associated with any alerts, they can be specified here. The action will be logged in any cases associated with the specified alerts.
At least
1element. Minimum length of each is1. -
The IDs of cases where the action taken will be logged.
At least
1element. Minimum length of each is1. -
Optional comment
-
List of endpoint IDs (cannot contain empty strings)
At least
1element. Minimum length of each is1. -
Optional parameters object
POST
/api/endpoint/action/runscript
curl \
--request POST 'https://localhost:5601/api/endpoint/action/runscript' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"agent_type":"microsoft_defender_endpoint","parameters":{"args":"-param1 value1 -param2 value2","scriptName":"my-script.ps1"},"endpoint_ids":["ed518850-681a-4d60-bb98-e22640cae2a8"]}'
Request examples
Run a script against a Microsoft Defender Endpoint agent
Microsoft Defender Endpoint runscript
{
"agent_type": "microsoft_defender_endpoint",
"parameters": {
"args": "-param1 value1 -param2 value2",
"scriptName": "my-script.ps1"
},
"endpoint_ids": [
"ed518850-681a-4d60-bb98-e22640cae2a8"
]
}
SentinelOne runscript
{
"agent_type": "sentinel_one",
"parameters": {
"scriptId": "1111-2222-3333-4444-5555-6666-7777-8888",
"scriptInput": "--delete --paths-to-delete /tmp/temp_file.txt,/tmp/random_file.txt"
},
"endpoint_ids": [
"ed518850-681a-4d60-bb98-e22640cae2a8"
]
}