linux - How do I troubleshoot a Python script that should log into a Windows server when there are no error messages? -
my ansible playbooks not working windows servers (2012). they've never worked correctly. installed pywinrm (0.1.1) on centos 7 server. have python 2.7.5. have basic python script imports winrm. have hardcoded credentials of local account (not domain account) windows server. script should connect windows server, there no error messages, , appears fail.
import winrm session = winrm.session('nameofwindowsserver', auth=('localuser', 'password'))
i ran powershell script prepares server used winrm. see no activity in windows server event log. how python script log windows server? seems silently failing. expect activity in event viewer of windows server.
update: failure silent, added 2 line script. added third line of python code:
remotecom = session.run_cmd('ipconfig', ['/all'])
i got error:
traceback (most recent call last) ... file "/usr/lib/python2.7/site-ackages/winrm/init.py", line 29, in run_cmd ... file "/usr/lib/python2.7/site-ackages/winrm/init.py", line 121, in run_cmd ... file "/usr/lib/python2.7/site-ackages/winrm/init.py", line 193, in run_cmd ... file "/usr/lib/python2.7/site-ackages/winrm/init.py", line 125, in run_cmd ... winrm.exceptions.unauthorizederror: 401 unauthorized
why getting error? why not seeing activity on windows server? should local user have denote not domain login?
Comments
Post a Comment