---
title: "Execute PowerShell command"
method: POST
path: "/v1/computer/{machine_id}/shell/powershell/exec"
tags: ["computer"]
---

# Execute PowerShell command

`POST /v1/computer/{machine_id}/shell/powershell/exec`

## Request

- Base URL: `https://api.cyberdesk.io`
- URL: `https://api.cyberdesk.io/v1/computer/{machine_id}/shell/powershell/exec`
- Auth: HTTP bearer

Execute PowerShell command on the machine.

## Path parameters

- `machine_id` string, required

## Headers

- `Idempotency-Key` string

## Request body

- PowerShellExecRequest
  - `command` string, required: PowerShell command to execute
  - `same_session` boolean: Use persistent session
  - `working_directory` string, nullable: Working directory for new session
  - `session_id` string, nullable: Session ID to use
  - `timeout` number, nullable: Maximum time in seconds to wait for command completion before returning. Cyberdriver 1.0.2+ continues one-shot commands in the background after timeout (default: 30.0)

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/cyberdesk-hq/apis/cyberdesk-cloud.md) - [All operations](https://skmtc.dev/cyberdesk-hq/apis/cyberdesk-cloud/llms.txt) - [OpenAPI document](https://skmtc.dev/cyberdesk-hq/apis/cyberdesk-cloud/revisions/5579352ae05e?raw)
