Runs a PowerShell or batch (.bat) script on Windows cloud desktops.
Operation description
You can use the RunCommand operation to run scripts only on Windows cloud desktops.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ecd:RunCommand | create | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The ID of the region. | cn-hangzhou |
Type | string | Yes | The language of the O&M command. Valid values:
| RunPowerShellScript |
CommandContent | string | Yes | The content of the command. The command content can be plaintext or Base64-encoded. Note
If the command content is Base64-encoded, you must set the ContentEncoding parameter to Base64.
| ipconfig |
Timeout | long | No | The timeout period for the command to run. Unit: seconds. Default value: 60. | 3600 |
ContentEncoding | string | No | The encoding mode of the command content. Valid values:
Default value: PlainText. If the specified value of this parameter is invalid, PlainText is used by default. | Base64 |
DesktopId | array | Yes | The ID of cloud desktop N. Valid values of N: 1 to 50. | |
string | Yes | The ID of the cloud desktop. | ecd-7w78ozhjcwa3u**** | |
EndUserId | string | No | The ID of the end user. If you specify a value, you run the command as the end user that is granted specific permissions. Note: The end user has sessions on a cloud computer. That is, when the cloud computer is started, the end user logs on to an Alibaba Cloud Workspace client and connects to the cloud computer, and the cloud computer is not preempted by another end user during the connection. This parameter is not available for Linux cloud computers. | User1 |
Response parameters
Examples
Sample success responses
JSON
format
{
"InvokeId": "t-hz01qgsqj2n****",
"RequestId": "1CBAFFAB-B697-4049-A9B1-67E1FC5F****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-08-13 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
2022-09-29 | The request parameters of the API has changed | View Change Details |