Skip to main content
Version: 12 - TBD

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.

For modes "run_batch_script" and "run_powershell_script" execution is resilient to conenction disruptions between the workspace and the Windows system.

While a script connection is running, partial updates are merged into the execution output_value as std_out and std_err (see live_output and live_output_poll_interval). Applies to run_powershell_script and run_batch_script. Set live_output=False to disable. Poll interval minimum is 1 second.

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.

Input Schema

  • schema_version = '10.0'

    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

  • script_timeout

    Maximum wait for batch or PowerShell script completion, in seconds. Use no limit to wait until the script finishes.

    Type: anyOf

  • live_output

    Stream partial output_value updates (std_out, std_err) while a script is running.

    Type: boolean

    Default: True

  • live_output_poll_interval

    How often to poll remote stdout and stderr log files for live output updates, in seconds.

    Type: integer

    Default: 1

Output Schema

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')