Microsoft WinRM Operators

use the WinRMOperator to execute commands on a given remote host using the winrm_hook

create a hook

airflow/providers/microsoft/winrm/example_dags/example_winrm.py[source]

winRMHook = WinRMHook(ssh_conn_id='ssh_POC1')

Run the operator, pass the hook, and pass a command to do something

airflow/providers/microsoft/winrm/example_dags/example_winrm.py[source]

t1 = WinRMOperator(task_id="wintask1", command='ls -altr', winrm_hook=winRMHook)

t2 = WinRMOperator(task_id="wintask2", command='sleep 60', winrm_hook=winRMHook)

t3 = WinRMOperator(task_id="wintask3", command='echo \'luke test\' ', winrm_hook=winRMHook)

Was this entry helpful?