Apache Airflow Provider for Microsoft WinRM
raw JSON → 3.14.2 verified Fri May 01 auth: no python
Apache Airflow provider to integrate with Microsoft WinRM for remote execution on Windows machines. Version 3.14.2 supports Airflow 2.19+ and Python >=3.10. Releases are published on PyPI with a cadence that aligns with Airflow provider updates.
pip install apache-airflow-providers-microsoft-winrm Common errors
error ModuleNotFoundError: No module named 'airflow.providers.microsoft.winrm' ↓
cause Provider package not installed or Airflow environment not restarted after installation.
fix
Run 'pip install apache-airflow-providers-microsoft-winrm' and restart the Airflow scheduler/webserver.
error KeyError: 'winrm_host' ↓
cause Missing required parameter in WinRMOperator or incorrect connection ID used.
fix
Ensure you pass both winrm_host and winrm_login when not using an Airflow connection URI.
error Connection to (192.168.1.100) timed out. (connect timeout=60) ↓
cause Remote WinRM service not reachable (firewall, wrong IP, WinRM not enabled).
fix
Verify remote host WinRM status with 'Test-WSMan -ComputerName 192.168.1.100' and check firewall rules.
Warnings
gotcha WinRM connection times out or fails if the remote Windows machine does not have WinRM properly configured (e.g., listener enabled, firewall rules, HTTPS with valid certificate). ↓
fix Run 'winrm quickconfig' on the target Windows host and ensure port 5986 (HTTPS) or 5985 (HTTP) is open.
deprecated The 'winrm_*' parameters (winrm_host, winrm_login, etc.) are the primary input; the older 'ssh_*' style parameters are not supported. ↓
fix Use documented WinRM parameters; do not mix SSH-style parameters.
gotcha The provider requires 'pywinrm' version compatible with the Kerberos or SSL authentication method you intend to use. Default HTTP may be rejected by modern Windows servers. ↓
fix Install with extras: pip install apache-airflow-providers-microsoft-winrm[kerberos] or configure HTTPS endpoint.
Imports
- WinRMOperator wrong
from airflow.providers.microsoft.winrm.operators.winrm_operator import WinRMOperatorcorrectfrom airflow.providers.microsoft.winrm.operators.winrm import WinRMOperator - WinRMHook wrong
from airflow.providers.microsoft.winrm.hooks import WinRMHookcorrectfrom airflow.providers.microsoft.winrm.hooks.winrm import WinRMHook
Quickstart
from datetime import datetime
from airflow import DAG
from airflow.providers.microsoft.winrm.operators.winrm import WinRMOperator
with DAG(dag_id='winrm_test', start_date=datetime(2023,1,1), schedule_interval=None, catchup=False) as dag:
task = WinRMOperator(
task_id='run_ipconfig',
winrm_host='192.168.1.100',
winrm_login='Administrator',
winrm_password='password',
command='ipconfig /all'
)