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.
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 = '10.0'Type:
string -
authenticationType:
anyOfOptions: -
schemeThe scheme to use.
Type:
anyOfOptions: -
hostThe remote hostname or IP address.
Type:
string -
portType:
anyOfOptions: -
pathThe path of the WinRM server.
Type:
stringDefault:
/wsman -
tlsIf to connect using TLS/SSL.
Type:
anyOfOptions: -
transportWhich transport to use.
Type:
anyOfOptions: -
message_encryptionIf to use message encryption.
Type:
anyOfOptions: -
modeType:
anyOfOptions: -
encodingThe encoding to use when binary data is returned by the server.
Type:
stringDefault:
utf-8
Output Schema
-
status_codeThe status code of the executed command.
Type:
integer -
std_outThe standard output of the executed command.
Type:
string -
std_errThe 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')