I am currently configuring a windows computer to accept remote access from ansible and I am having a problem while running the script ConfigureRemotingForAnsible.ps1.
Here is the error :
PS D:\Ansible\Power Shell 3> .\ConfigureRemotingForAnsible.ps1
Unable to establish an HTTP or HTTPS remoting session.
Au caractère D:\Ansible\Power Shell 3\ConfigureRemotingForAnsible.ps1:129 : 5
Throw “Unable to establish an HTTP or HTTPS remoting session.”
CategoryInfo : OperationStopped: (Unable to estab…moting session.:String) , RuntimeException
FullyQualifiedErrorId : Unable to establish an HTTP or HTTPS remoting session.
I have checked my authentication configuration an it seems ok.
I have downloaded the latest version of the script and have the windows management framework installed.
The server is up and running because I’ve already managed to run a command remotely on my own computer through a winrs command.
In fact, I’ve managed to run the ConfigureRemotingForAnsible.ps1 script completely by just bypassing the Test a remoting connection to localhost, which should work. by commenting the lines 115 to 130. I know this is not elegant.
After that operation, I did a simple “ansible windows -m win_ping” command from my server to the windows client and it worked !
Still don’t know why this test during the configuration script execution failed.
My guess would be firewall configuration on the windows machine is stopping the remoting to localhost from working.
The other place to look would be in the winrm configuration.
Sometimes checking the windows event log can be helpful - have you looked there?
Checking the windows evetn log was so obvious that I didn’t think about it.
While running the script and getting the error, the event has recorded this event (sorry this is in french but I think it is understandable) :
08/06/2015 08:34:20 142 Erreur L’opération WSMan CreateShell a échoué, code d’erreur 5
08/06/2015 08:34:20 254 Information Transfert d’activité
08/06/2015 08:34:20 162 Erreur L’authentification de l’utilisateur a échoué. Les informations d’identification n’ont pas fonctionné.
When I dig into the authentication error information I can see that the user listed is ITEM-81502\efibtf. This is the local user (with admin rights) that I am using to run the configuration script.
On the Control Machine I am using the same user but without the computer prefix and it works fine.
Maybe I should run the script as admin instead of running it as an user with admin rights ?
Otherwise, do you have any idea how can I manage to authenticate without having the user prefixed with the computer name ?