Skip to content

Commit

Permalink
add run script api powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Jan 22, 2024
1 parent 6940ef4 commit 9a79eb7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/functions/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,36 @@ Here are some examples:
}
```

???+ abstract "Example: Run a script on an agent"

=== ":material-powershell: PowerShell"

```powershell
$apiUrl = 'https://api.example.com/agents/CHANGEME/runscript/'

$jsonPayload = @{
output = "wait"
emails = @()
emailMode = "default"
custom_field = $null
save_all_output = $false
script = 20
args = @()
env_vars = @()
run_as_user = $false
timeout = 90
} | ConvertTo-Json


$headers = @{
'Content-Type' = 'application/json'
'X-API-KEY' = 'changeme'
}

$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonPayload -Headers $headers
$response
```

## API via CLI

<https://gitlab.com/NiceGuyIT/trmm-cli>
Expand Down

0 comments on commit 9a79eb7

Please sign in to comment.