All Products
Search
Document Center

Elastic Desktop Service:RunCommand

Last Updated:Jul 25, 2024

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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:
    • The required resource types are displayed in bold characters.
    • 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.
OperationAccess levelResource typeCondition keyAssociated operation
ecd:RunCommand
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The ID of the region.

cn-hangzhou
TypestringYes

The language of the O&M command. Valid values:

  • RunBatScript
  • RunPowerShellScript
RunPowerShellScript
CommandContentstringYes

The content of the command. The command content can be plaintext or Base64-encoded.
The Base64-encoded command content cannot exceed 16 KB in size.

Note If the command content is Base64-encoded, you must set the ContentEncoding parameter to Base64.
ipconfig
TimeoutlongNo

The timeout period for the command to run. Unit: seconds. Default value: 60.
A timeout error occurs if the command cannot be run because the process slows down or because a specific module or the Cloud Assistant client does not exist. When a timeout error occurs, the command process is forcibly terminated.

3600
ContentEncodingstringNo

The encoding mode of the command content. Valid values:

  • PlainText: The command content is not encoded.
  • Base64: The command content is Base64-encoded.

Default value: PlainText. If the specified value of this parameter is invalid, PlainText is used by default.

Base64
DesktopIdarrayYes

The ID of cloud desktop N. Valid values of N: 1 to 50.
If multiple cloud desktops are specified and the command execution succeeds on at least one of the cloud desktops, the operation is considered successful. If multiple cloud desktops are specified and the command execution fails on all the cloud desktops, verify the value of the parameter and try again.

stringYes

The ID of the cloud desktop.

ecd-7w78ozhjcwa3u****
EndUserIdstringNo

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

ParameterTypeDescriptionExample
object

The object that is returned.

InvokeIdstring

The ID of the command execution.

t-hz01qgsqj2n****
RequestIdstring

The ID of the request.

1CBAFFAB-B697-4049-A9B1-67E1FC5F****

Examples

Sample success responses

JSONformat

{
  "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 timeSummary of changesOperation
2022-09-29The request parameters of the API has changedView Change Details