run-powershell-script
Execute PowerShell code against Sitecore XM, XP, or SitecoreAI and return the output for item, media, security, publishing, and logging tasks.
Instructions
Runs a PowerShell script and returns the output. Before writing a script that changes many items, read the guide://bulk-update resource: it carries the pattern a mass write needs (every ID resolved from the instance, a named subtree as the root, a dry run the user approves, BeginEdit/EndEdit with a per-item try/catch).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"script": "<script>"
},
"name": "run-powershell-script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | The Powershell script to run. |