На целевом компьютере выполните команду
Код: Выделить всё
Enable-PSRemoting -ForceКод: Выделить всё
Enter-PSSession -ComputerName <имя_или_IP_адрес_компьютера> -Credential (Get-Credential)Код: Выделить всё
Enable-PSRemoting -ForceКод: Выделить всё
Enter-PSSession -ComputerName <имя_или_IP_адрес_компьютера> -Credential (Get-Credential)Код: Выделить всё
pip install pywinrmКод: Выделить всё
import winrm
session = winrm.Session('http://<ip-адрес-вашей-Windows>:5985/wsman', auth=('имя_пользователя', 'пароль'))
result = session.run_cmd('ipconfig')
print(result.std_out.decode())Код: Выделить всё
python ваш_скрипт.pyКод: Выделить всё
ansible windows -m win_command -a "ipconfig" -i hosts.iniКод: Выделить всё
[windows]
<ip-адрес-Windows> ansible_user=имя_пользователя ansible_password=пароль ansible_connection=winrm ansible_winrm_transport=ntlm