Я хотел бы написать скрипт на Python, используя библиотеку pywinrm, чтобы иметь возможность подключаться к удаленному компьютеру через WinRM.
import winrm
s = winrm.Session('MACHINEHOST', auth=('username@domain', 'password'))
r = s.run_cmd('ipconfig', ['/all'])
print r.status_code
print r.std_out
Скрипт работает нормально, когда я использую локального пользователя. Когда я использую пользователя домена, я получаю следующее исключение:
winrm.exceptions.UnauthorizedError: 401 Unauthorized.
Что касается конфигурации WinRM на удаленной машине:
/Client/Auth/Basic = True
/Client/TrustedHosts = *
/Service/Auth/Basic = True
/Service/AllowUnencrypted = True
Не подскажете, как исправить эту проблему?
Спасибо.