Microsoft WinRM 操作器

使用 WinRMOperator 通过 winrm_hook 在给定的远程主机上执行命令

创建一个钩子

tests/system/providers/microsoft/winrm/example_winrm.py[源代码]

winRMHook = WinRMHook(ssh_conn_id="ssh_POC1")

运行操作器,传递钩子,并传递一个命令来执行操作

tests/system/providers/microsoft/winrm/example_winrm.py[源代码]

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)

此条目有帮助吗?