WinRM configuration script error

2,592 views
Skip to first unread message

Rene Metery

unread,
Jun 4, 2015, 11:32:59 AM6/4/15
to ansible...@googlegroups.com
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

benno joy

unread,
Jun 4, 2015, 12:10:22 PM6/4/15
to ansible...@googlegroups.com
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 




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5b811610-9731-4405-b5b8-e1f499cbf9cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

J Hawkesworth

unread,
Jun 4, 2015, 3:01:34 PM6/4/15
to ansible...@googlegroups.com
Do you have windows management framework installed?

Bob Tanner

unread,
Jun 5, 2015, 12:22:13 AM6/5/15
to ansible...@googlegroups.com
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

Rene Metery

unread,
Jun 5, 2015, 4:35:04 AM6/5/15
to ansible...@googlegroups.com
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.

J Hawkesworth

unread,
Jun 5, 2015, 7:34:58 AM6/5/15
to ansible...@googlegroups.com
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


On Thursday, June 4, 2015 at 4:32:59 PM UTC+1, Rene Metery wrote:

Bob Tanner

unread,
Jun 5, 2015, 8:59:50 AM6/5/15
to ansible...@googlegroups.com
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.

Rene Metery

unread,
Jun 8, 2015, 3:09:59 AM6/8/15
to ansible...@googlegroups.com
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 ?

Rene Metery

unread,
Jun 8, 2015, 3:12:03 AM6/8/15
to ansible...@googlegroups.com
Thanks for the link, I will check into it.

Snehit

unread,
Feb 15, 2018, 3:53:27 AM2/15/18
to Ansible Project
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
Reply all
Reply to author
Forward
0 new messages