All Products
Search
Document Center

Elastic Desktop Service:RunCommand

Last Updated:Oct 17, 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

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
2024-08-13The internal configuration of the API is changed, but the call is not affectedView Change Details
2022-09-29The request parameters of the API has changedView Change Details