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.
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
Type:
string
-
authentication
Type:
anyOf
Options: -
scheme
The scheme to use.
Type:
anyOf
Options: -
host
The remote hostname or IP address.
Type:
string
-
port
Type:
anyOf
Options: -
path
The path of the WinRM server.
Type:
string
Default:
/wsman
-
tls
If to connect using TLS/SSL.
Type:
anyOf
Options: -
transport
Which transport to use.
Type:
anyOf
Options: -
message_encryption
If to use message encryption.
Type:
anyOf
Options: -
mode
Type:
anyOf
Options: -
encoding
The encoding to use when binary data is returned by the server.
Type:
string
Default:
utf-8
-
script_timeout
The timeout for the script execution in seconds.
Type:
integer
Default:
60
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')