# WindowsExecutor Operator

The **WindowsExecutor** operator executes a command on a target Windows machine using WinRM.

The command can be anything that runs on a Windows Command Prompt.

## Operator arguments <a href="#operator-arguments" id="operator-arguments"></a>

<table><thead><tr><th width="172">Name</th><th width="101">Type</th><th>Value Restrictions</th><th width="97">Required</th><th width="94">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>command</code></td><td>String</td><td> </td><td>Yes</td><td> </td><td>The command to be executed on the remote machine</td></tr><tr><td><code>host</code></td><td>Object</td><td>It should have a structure like the one described here below</td><td>No</td><td> </td><td>Information relative to the target machine onto which the command has to be executed</td></tr><tr><td><code>component</code></td><td>String</td><td>It should match the name of an existing Component of the System under test</td><td>No</td><td> </td><td>The name of the Component whose properties can be used as arguments of the operator</td></tr></tbody></table>

### `host` structure and arguments <a href="#defining-a-host-for-a-command" id="defining-a-host-for-a-command"></a>

Here follows the structure of the `host` argument

{% code lineNumbers="true" %}

```yaml
host:
  protocol: [https|http]
  hostname: this_is_a_hostname
  port: 5863
  path: /wsman
  username: this_is_a_username
  password: this_is_a_password
  validateCertificate: false
```

{% endcode %}

with its arguments:

<table><thead><tr><th width="155">Name</th><th width="90">Type</th><th width="132">Value Restrictions</th><th width="167">Required</th><th width="75">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>protocol</code></td><td>String</td><td><ul><li>https</li><li>http</li></ul></td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->protocol</code></td><td>https</td><td>The protocol to use to connect to the Windows machine with WinRM</td></tr><tr><td><code>hostname</code></td><td>String</td><td>Valid FQDN or ip address</td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->hostname</code></td><td>-</td><td>Windows machine’s hostname</td></tr><tr><td><code>port</code></td><td>Number</td><td>1≤<code>port</code>≤65532</td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->port</code></td><td>5863</td><td>WinRM port</td></tr><tr><td><code>path</code></td><td>String</td><td>-</td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->path</code></td><td>/wsman</td><td>The path where WinRM is listening</td></tr><tr><td><code>username</code></td><td>String</td><td><ul><li>username</li><li>domain\username</li><li>username@domain</li></ul></td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->hostname</code></td><td>-</td><td>User login (domain or local)</td></tr><tr><td><code>password</code></td><td>String</td><td>-</td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->password</code></td><td>-</td><td>Login password</td></tr><tr><td><code>authType</code></td><td>String</td><td><ul><li>ntlm</li><li>ssl</li></ul></td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->authType</code></td><td>ntlm</td><td>The authentication method to use against Windows machine</td></tr><tr><td><code>validateCertificate</code></td><td>Boolean</td><td><ul><li>true</li><li>false</li></ul></td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->validateCertificate</code></td><td>False</td><td>Whether or not validate the server certificate</td></tr><tr><td><code>ca</code></td><td>String</td><td>A valid CA certificate</td><td>Yes, if the Component whose name is defined in <code>component</code> hasn’t a property named <code>host->ca</code></td><td>-</td><td>The CA that is required to validate the servier certificate</td></tr><tr><td><code>operationTimeoutSec</code></td><td>Integer</td><td>Must be greather then 0</td><td>No</td><td> </td><td><p>The amount in seconds after which the execution of the command is considered failed</p><p>Notice that the ouput of the command doesn’t reset the timeout.</p></td></tr><tr><td><code>readTimeoutSec</code></td><td>Integer</td><td>Must be greather then <code>operationTimeoutSec</code></td><td>No</td><td> </td><td>The amount of seconds to wait before an HTTP connect/read times out</td></tr></tbody></table>

### Get operator arguments from `component` <a href="#get-operator-arguments-from-component" id="get-operator-arguments-from-component"></a>

The `component` argument can refer to a Component by name and use its properties as the arguments of the operator. In case the mapped arguments are already provided to the operator, there is no override.

Here is an example of a component that overrides the `host` and the `command` arguments:

{% code lineNumbers="true" %}

```yaml
name: LoadRunnerMachine
componentType: WebApplication
properties:
  command: "dir c:\"
  host:
    hostname: lr.mydomain.com
    usernane: MyLoadRunnerUser
    password: MyPassword
```

{% endcode %}

### Examples <a href="#examples" id="examples"></a>

#### Execute a *dir* command with explicit host information <a href="#execute-a-dir-command-with-explicit-host-information" id="execute-a-dir-command-with-explicit-host-information"></a>

{% code lineNumbers="true" %}

```yaml
name: TestConnectivity
operator: WindowsExecutor
arguments:
  command: "dir c:\"
  host:
    hostname: frontend.akamas.io
    username: administrator
    password: MyPassword
```

{% endcode %}

#### Execute a *dir* command with host information taken from a Component <a href="#execute-a-dir-command-with-host-information-taken-from-a-component" id="execute-a-dir-command-with-host-information-taken-from-a-component"></a>

{% code lineNumbers="true" %}

```yaml
name: TestConnectivity
operator: WindowsExecutor
arguments:
  command: "dir c:\"
  component: frontend1
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.akamas.io/akamas-docs/3.1.2/akamas-reference/workflow-operators/windowsexecutor-operator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
