Skip to content

Latest commit

 

History

History
99 lines (78 loc) · 4.67 KB

plugin-winrm.adoc

File metadata and controls

99 lines (78 loc) · 4.67 KB

WinRM Plugin

The plugin provides functionality to execute commands via WinRM.

Properties

It’s allowed to configure unlimited number of WinRM connections via mechanism of the dynamic properties. The properties prefix example is:

winrm.server.my-server

where my-server is a key used to refer WinRm connection in the steps. The key is defined by users, must be unique and can’t contain dots.

Steps

Configure dynamic WinRM connection

Creates a new dynamic WinRM connection from the provided parameters, the connection is available only within the story creating the connection.

When I configure WinRM connection with key `$connectionKey` and parameters:$connectionParameters
  • $connectionKey - The key to assign to the creating WinRM connection. In case if the key conflicts with a global connection key, the dynamic connection will take precedence within the story.

  • $connectionParameters - The ExamplesTable with WinRM connection parameters.

Configure WinRM connection dynamically
When I configure WinRM connection with key `my-connection` and parameters:
|address         |username |password|authentication-scheme|
|10.10.10.10:5985|admin    |Pa$$w0rd|Basic                |

Execute batch command

Executes a native Windows command. A new session is created on the destination host for each step invocation.

When I execute batch command `$command` on server `$connectionKey` using WinRM and save result to $scopes variable `$variableName`
  • $command - The batch command limited to 8096 bytes. The maximum length of the command can be even less depending on the platform.

  • $connectionKey - The WinRM connection key matching any of configured ones.

  • $scopes - The comma-separated set of the variables scopes.

  • $variableName - The variable name to store the command execution results. The data will be stored under the following keys:

Check batch command result
When I execute batch command `echo hello cmd` on server `my-server` using WinRM and save result as JSON to scenario variable `cmd-result`
Then `${cmd-result.stdout}` is equal to `hello cmd`
Then `${cmd-result.stderr}` is equal to ``
Then `${cmd-result.exit-status}` is equal to `0`

Execute PowerShell command

Executes a PowerShell[https://docs.microsoft.com/en-us/powershell/scripting/overview] command. A new session is created on the destination host for each step invocation.

When I execute PowerShell command `$command` on server `$connectionKey` using WinRM and save result to $scopes variable `$variableName`
  • $command - The PowerShell command.

  • $connectionKey - The WinRM connection key matching any of configured ones.

  • $scopes - The comma-separated set of the variables scopes.

  • $variableName - The variable name to store the command execution results. The data will be stored under the following keys:

Check PowerShell command result
When I execute PowerShell command `echo hello ps` on server `my-server` using WinRM and save result to scenario variable `ps-result`
Then `${ps-result.stdout}` is equal to `hello ps`
Then `${ps-result.stderr}` is equal to ``
Then `${ps-result.exit-status}` is equal to `0`