Ansible WinRM works with administrator account but not with other accounts in windows

83 Views Asked by At

I have configured WinRM in one of the Windows machines and using the below commands

New-SelfSignedCertificate -DnsName "EC2-KI33TN5" -CertStoreLocation Cert:\LocalMachine\My

winrm create winrm/config/Listener?Address=*+Transport=HTTPS  '@{Hostname="EC2-KI33TN5";CertificateThumbprint="9885C91EFSDFEWFSFWAWFEWFWEFFW61FEC661C5253"}'

I have created a Self-Signed certificate and added it to the Windows Machine's root. I have a Linux server that has Ansible installed and works fine for other Linux machines

Now the issue is when I try to check the connectivity to Windows Machine using administrator user using win_ping module in ansible playbook, the connection works fine and I'm able to ping and pong response and when I try with any other user which I have created and added to administrator group, it doesn't work and I see below error message

<10.10.10.245> ESTABLISH WINRM CONNECTION FOR USER: ansibleadmin on PORT 5986 TO 10.10.10.245
fatal: [WINDOWS_TEST]: UNREACHABLE! => {
    "changed": false,
    "msg": "ntlm: the specified credentials were rejected by the server",
    "unreachable": true
}

I have verified if WinRM is running on HTTPS using the below command and it shows as running

PS C:\Windows\system32> WinRM e winrm/config/listener
Listener
    Address = *
    Transport = HTTP
    Port = 5985
    Hostname
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint
    ListeningOn = 10.10.10.245, 127.0.0.1, ::1, 2001:0:34f1:8072:34f7:a78:f5f5:f508, fe80::5efe:10.10.10.245%7, fe80::34
f7:a78:f5f5:f508%8, fe80::dca2:59f6:8dd1:e2d0%6

Listener
    Address = *
    Transport = HTTPS
    Port = 5986
    Hostname = EC2-KI33TN5
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint = 9885C91EFSDFEWFSFWAWFEWFWEFFW61FEC661C5253
    ListeningOn = 10.10.10.245, 127.0.0.1, ::1, 2001:0:34f1:8072:34f7:a78:f5f5:f508, fe80::5efe:10.10.10.245%7, fe80::34
f7:a78:f5f5:f508%8, fe80::dca2:59f6:8dd1:e2d0%6

Any help is appreciated and I'm not able to find any clues and solutions on this.

0

There are 0 best solutions below