winops_cmd_powershell
Execute PowerShell commands on Windows and get stdout, stderr, exit code, and execution time with configurable timeouts and working directories.
Instructions
Execute a PowerShell command and return stdout, stderr, exit_code, execution_time.
Return Format
{
"success": bool,
"message": str,
"stdout": str,
"stderr": str,
"exit_code": int,
"execution_time": float,
"next_steps": str | [],
"sampling_advice": str
}Examples
powershell(command="Get-Service | Where-Object Status -eq 'Running'")
powershell(command="Get-Process | Sort-Object CPU -Descending | Select -First 10")Notes:
Uses asyncio.to_thread — never blocks the event loop.
ctx.sample() capped at 10s to prevent hang on unsupported clients.
Safety guards block Linux-isms (grep, tail, rm -rf, etc.) and em dashes.
stdout/stderr truncated at max_output_size chars each.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | PowerShell command to execute. | |
| stdin_data | No | Optional data to pipe to stdin of the command. | |
| max_output_size | No | Truncate stdout/stderr at this many chars. | |
| timeout_seconds | No | Hard timeout 1-300s. | |
| working_directory | No | Optional working directory. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||