WinRM configuration script error

Hi,

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.

PS D:\Ansible\Power Shell 3> winrm get winrm/config
Config
MaxEnvelopeSizekb = 500
MaxTimeoutms = 60000
MaxBatchItems = 32000
MaxProviderRequests = 4294967295
Client
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = false
Auth
Basic = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = false

If you have any idea about the problem it will greatly help me.
I can’t find any post about that problem.

Cheers,

René METERY

not sure here but are you using the latest version of the configure script ? https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
also is the winrm server running on port 5985 5986, iirc

Do you have windows management framework installed?

What does $PSVersionTable return for you?

PS > $PSVersionTable

Name Value


PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.34209
BuildVersion 6.3.9600.16406
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2

Here is the output of : PS > $PSVersionTable

Name Value


PSVersion 3.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.34209
BuildVersion 6.2.9200.16398
PSCompatibleVersions {1.0, 2.0, 3.0}
PSRemotingProtocolVersion 2.2

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?

Jon

Any helpful info here?

http://powershell.com/cs/media/p/7257.aspx#windows-powershell-remoting

Similar to the firewall check, check the trusted hosts. That was my problem.

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 ?

Thanks for the link, I will check into it.

Hi Rene ,

Have you able to resolve this issue ?
I am also have same problem.

<<

Unable to establish an HTTP or HTTPS remoting session.
At C:\Users\snehit.rahate\Desktop\ConfigureRemotingForAnsible.ps1:404 char: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.

Thanks,
Snehit

On
Monday, 8 June 2015 12:42:03 UTC+5:30, Rene Metery wrote: