Skip to main content

WinRM installation

notizen

  • wlan/ethernet auf privat statt öffentlich stellen
  • ssh auf windows ist scheiße
  • lokalen ADMIN user erstellen

windows client:

  35 winrm quickconfig
  36 winrm quickconfig
  37 winrm set winrm/config/service/Auth '@{Basic="true"}'
  38 winrm set winrm/config/service '@{AllowUnencrypted="true"}'
  39 Enable-PSRemoting -Force
  40 ping 192.168.200.11
  41 netsh advfirewall firewall show rule name="Windows Remote Management (HTTP-In)"
  42 netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes
  43 Enable-NetFirewallRule -Name FPS-ICMP4-ER-In
  44 Enable-NetFirewallRule -Name FPS-ICMP6-ER-In
  45 winrm quickconfig
  46 Enable-NetFirewallRule -Name "WINRM-HTTP-In-TCP"
  47 Enable-NetFirewallRule -Name "WINRM-HTTPS-In-TCP"

linux ansible host:

    58s    1h ago sudo apt update
    451ms 53m ago sudo apt install python3-pywinrm
    324ms 53m ago pip3 install pywinrm
    447ms 53m ago sudo apt install gcc python-devel krb5-devel krb5-workstation python-devel
    5s    49m ago sudo apt install python3-venv
    3s    49m ago pip install pywinrm
    289ms 38m ago ansible
    3ms   38m ago mkdir ansible-test
    9s    35m ago nano testtoast.yaml
    617us 32m ago cd PL/
    6ms   32m ago source .venv/bin/activate
    1s    32m ago python3 -m venv .venv

nano testtoast.yaml

- name: Test Ansible on Windows via WinRM
  hosts: windev
  gather_facts: no  
  tasks:
    - name: Textdatei schreiben
      win_copy:
        content: "Hallo Meister Eike, Ansible ist hier!"
        dest: C:\Temp\ansible_test.txt

 nano win-inv:

[windev]
win-testlaptop ansible_host=192.168.3.97

[windev:vars]
ansible_user=ansible-winrm
ansible_password=Ha...r50..
ansible_connection=winrm
ansible_winrm_transport=basic
ansible_port=5985

cmd:
ansible-playbook -i win-inv testtoast.yaml