Skip to main content
Version: 10 - Vanillekipferl

ConnectorTypePS

class connector_types.connector_type_ps.ConnectorTypePS

Access a Windows Remote Management (WinRM) service.

This connector type enables you to interact with a Windows Remote Management (WinRM) service. See Windows Remote Management for information about WinRM.

note

Cancelling an active execution created by a PS connector might not be possible if the third party system, that is running the script, doesn't respond. In this case Cloudomation Engine sends the signal to cancel the process on the third party system but as long as the script is running on said system, the execution status will be shown a running in Engine. To cancel the execution you have to kill the process directly in the non-responsive system.

Input Schema

  • schema_version

    Type: string

  • authentication

    Type: anyOf

  • scheme

    The scheme to use.

    Type: anyOf

  • host

    The remote hostname or IP address.

    Type: string

  • port

    Type: anyOf

  • path

    The path of the WinRM server.

    Type: string

    Default: /wsman

  • tls

    If to connect using TLS/SSL.

    Type: anyOf

  • transport

    Which transport to use.

    Type: anyOf

  • message_encryption

    If to use message encryption.

    Type: anyOf

  • mode

    Type: anyOf

  • encoding

    The encoding to use when binary data is returned by the server.

    Type: string

    Default: utf-8

Output Schema

  • status_code

    The status code of the executed command.

    Type: integer

  • std_out

    The standard output of the executed command.

    Type: string

  • std_err

    The standard error of the executed command.

    Type: string

Example

Execute a command using NTLM authentication

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='PS',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
scheme='http',
host='...',
port={
'port_mode': 'service_name',
'service_name': 'wsman',
},
transport='ntlm',
mode={
'mode_name': 'execute_command',
'command': 'ipconfig',
'args': ['/all'],
},
encoding='windows-1252',
)

Run a Powershell script using certificate authentication

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='PS',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
scheme='https',
host='...',
port=5986,
path='/wsman',
tls={
'tls_mode': 'use_tls_ssl',
'verify_ssl': True,
'server_ca': '...',
'check_hostname': True,
'client_cert': '...',
'client_key': '...',
},
transport='ssl',
message_encryption='always',
mode={
'mode_name': 'run_powershell_script',
'script': 'Write-Host "Hello World!"',
},
)
return this.success('all done')