title: python winrm connect using local account
body: <p>I'm trying to connect to Windows server 2012 via python 2.7.13 on CentOS using winrm. The server is not part of a domain. I created a separate local administrator account to connect to it. </p>
  
  <p>Used  <code>winrm configSDDL default</code> to provide that user all access. </p>
  
  <p>Added my client machine to trusted hosts. </p>
  
  <pre><code>PS C:\Windows\system32&gt; Get-Item WSMan:\localhost\Client\TrustedHosts
  
  
     WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client
  
  Type            Name                           SourceOfValue   Value
  ----            ----                           -------------   -----
  System.String   TrustedHosts                                   172.27.150.95
  </code></pre>
  
  <p>Added exception in the firewall and made sure the service is up. </p>
  
  <pre><code>PS C:\Windows\system32&gt; netsh advfirewall firewall add rule name="WinRM-HTTP" dir=in localport=5985 protocol=TCP action=allow
  Ok.
  
  PS C:\Windows\system32&gt; Get-Service -ComputerName abc -Name winrm | Select Status
  
                                                                                                                                                           Status
                                                                                                                                                           ------
                                                                                                                                                          Running
  
  
  PS C:\Windows\system32&gt;
  </code></pre>
  
  <p>Client settings for winrm:</p>
  
  <pre><code>PS C:\Windows\system32&gt; winrm get winrm/config/client
  Client
      NetworkDelayms = 5000
      URLPrefix = wsman
      AllowUnencrypted = true
      Auth
          Basic = true
          Digest = true
          Kerberos = true
          Negotiate = true
          Certificate = true
          CredSSP = false
      DefaultPorts
          HTTP = 5985
          HTTPS = 5986
      TrustedHosts = 172.27.150.95
  </code></pre>
  
  <p>Telnet is working:</p>
  
  <pre><code>xyz:~ # telnet 172.27.148.29 5985
  Trying 172.27.148.29...
  Connected to abc (172.27.148.29).
  Escape character is '^]'.
  ^]
  telnet&gt; quit
  Connection closed.
  xyz:~ # 
  </code></pre>
  
  <p>But still: </p>
  
  <pre><code>&gt;&gt;&gt; s = winrm.Session('abc', auth=('abc\script-runner', 'xxx'))                   
  &gt;&gt;&gt; r = s.run_cmd('ipconfig', ['/all'])
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python2.7/site-packages/winrm/__init__.py", line 37, in run_cmd
      shell_id = self.protocol.open_shell()
    File "/usr/local/lib/python2.7/site-packages/winrm/protocol.py", line 132, in open_shell
      res = self.send_message(xmltodict.unparse(req))
    File "/usr/local/lib/python2.7/site-packages/winrm/protocol.py", line 207, in send_message
      return self.transport.send_message(message)
    File "/usr/local/lib/python2.7/site-packages/winrm/transport.py", line 190, in send_message
      raise InvalidCredentialsError("the specified credentials were rejected by the server")
  winrm.exceptions.InvalidCredentialsError: the specified credentials were rejected by the server
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Also, I enabled Auditing for failed/successful logons but I don't see either failed or success for my attempts to connect. </p>
  
  <p>Please tell me what's missing? I want to connect via local user. </p>
  
  <p>Appreciate your assistance. </p>