WinRM Plugin

The plugin provides functionality to execute commands via WinRM.

Installation

  1. Copy the below line to dependencies section of the project build.gradle file

    Please make sure to use the same version for all VIVIDUS dependencies.
    Example 1. build.gradle
    implementation(group: 'org.vividus', name: 'vividus-plugin-winrm')
  2. If the project was imported to the IDE before adding new dependency, re-generate the configuration files for the used IDE and then refresh the project in the used IDE.

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.

The properties marked with bold are mandatory.
Name Acceptable values Default Description

winrm.server.<key>.address

<string>

Either full endpoint URL (e.g. https://10.240.1.1:5986/wsman) or hostname and port separated by colon (e.g. 10.240.1.1:5986)

winrm.server.<key>.username

<string>

The name of the user logging in

winrm.server.<key>.password

<string>

The password of the user logging in

winrm.server.<key>.authentication-scheme

Basic
Digest
NTLM
Negotiate
Kerberos
CredSSP

NTLM

Authentication scheme

winrm.server.<key>.disable-certificate-checks

true
false

false

Disable/enable HTTPS certificates validation

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.

    The parameters marked with bold are mandatory.
Name Acceptable values Default Description

address

<string>

Either full endpoint URL (e.g. https://10.240.1.1:5986/wsman) or hostname and port separated by colon (e.g. 10.240.1.1:5986)

username

<string>

The name of the user logging in

password

<string>

The password of the user logging in

authentication-scheme

Basic
Digest
NTLM
Negotiate
Kerberos
CredSSP

NTLM

Authentication scheme

disable-certificate-checks

true
false

false

Disable/enable HTTPS certificates validation

Example 2. 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`
Example 3. 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`
Example 4. 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`