Executes a PowerShell or Bat script on one or more cloud computers that run Windows.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecd:RunCommand |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID. |
cn-hangzhou |
| Type |
string |
Yes |
The language type of the O&M script. Valid values:
|
RunPowerShellScript |
| CommandContent |
string |
Yes |
The plaintext or Base64-encoded content of the script. Note
If the script content is Base64-encoded, set the ContentEncoding parameter to Base64. |
ipconfig |
| Timeout |
integer |
No |
The timeout period for executing the script. Unit: seconds. Default value: 300. |
3600 |
| ContentEncoding |
string |
No |
The encoding method of the script content. Note
If the specified value is not within the valid values, the value is treated as Valid values:
|
Base64 |
| DesktopId |
array |
Yes |
The list of cloud computer IDs. Valid values of N: 1 to 50. |
|
|
string |
No |
The cloud computer ID. |
ecd-7w78ozhjcwa3u**** |
|
| EndUserId |
string |
No |
The ID of the end user. If this parameter is specified, the command is executed with the permissions of the end user. Note
The user must have a session record on the cloud computer (the user has logged on and connected to the cloud computer after it was started, and the session was not preempted by another user). This parameter is not supported for Linux cloud computers. |
alice |
| CommandRole |
string |
No |
The role used when the command is executed on the cloud computer. |
system |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response object. |
||
| InvokeId |
string |
The script execution ID. You can call DescribeInvocations and pass in this value to query the script execution status. |
t-hz01qgsqj2n**** |
| RequestId |
string |
The request ID. |
1CBAFFAB-B697-4049-A9B1-67E1FC5F**** |
Examples
Success response
JSON format
{
"InvokeId": "t-hz01qgsqj2n****",
"RequestId": "1CBAFFAB-B697-4049-A9B1-67E1FC5F****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidCmdType.MisMatch | The specified instance type does not match the command. | The specified instance type does not match the command. |
| 400 | InvalidDesktopId | Invalid desktop id found, please check. | Invalid desktop id found, please check |
| 400 | InvalidEndUser.NotFound | End user is not found. | End user is not found |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.