Run a script
Spaces method and path for this operation:
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. parameters
object Required One of the following set of parameters must be provided
One of: Security_Endpoint_Management_API_RawScriptParametersobject Security_Endpoint_Management_API_HostPathScriptParametersobject Security_Endpoint_Management_API_CloudFileScriptParametersobject Security_Endpoint_Management_API_SentinelOneRunScriptParametersobject Security_Endpoint_Management_API_MDERunScriptParametersobject -
Optional parameters object
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"]}'
{
"agent_type": "microsoft_defender_endpoint",
"parameters": {
"args": "-param1 value1 -param2 value2",
"scriptName": "my-script.ps1"
},
"endpoint_ids": [
"ed518850-681a-4d60-bb98-e22640cae2a8"
]
}
{
"agent_type": "sentinel_one",
"parameters": {
"script": "1111-2222-3333-4444-5555-6666-7777-8888",
"inputParams": "--delete --paths-to-delete /tmp/temp_file.txt,/tmp/random_file.txt"
},
"endpoint_ids": [
"ed518850-681a-4d60-bb98-e22640cae2a8"
]
}