# Problem in exuting ConfigureRemotingForAnsible.ps1 in windows 7

**URL:** <https://forum.ansible.com/t/problem-in-exuting-configureremotingforansible-ps1-in-windows-7/16995>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [December 9, 2014, 11:44am UTC](https://forum.ansible.com/t/problem-in-exuting-configureremotingforansible-ps1-in-windows-7/16995 "2014-12-09T11:44:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![youmarva](https://avatars.discourse-cdn.com/v4/letter/y/3d9bf3/32.png) [@youmarva](https://forum.ansible.com/u/youmarva)\
**Post date:** [December 9, 2014, 11:44am UTC](https://forum.ansible.com/t/problem-in-exuting-configureremotingforansible-ps1-in-windows-7/16995/1 "2014-12-09T11:44:40Z")

</div>

I want to exécute in a windows 7 machine to allow connexion with Ansible.

In some Machines I have this error when executing ConfigureRemotingForAnsible.ps1 (as admin) :

PS C:\Users\adminsifast\Documents\Ansible\> .\ConfigureRemotingForAnsible.ps1

WinRM has been updated to receive requests.  
The type of the WinRM service was successfully modified.

**or**  
**(WinRM is already configured to receive this request)**

C:\Users\adminsifast\Documents\Ansible\ConfigureRemotingForAnsible.ps1 : Could not establish session on either HTTP or  
HTTPS. Breaking  
Au caractère Ligne:1 : 1

- .\ConfigureRemotingForAnsible.ps1
- 

```auto

```

- CategoryInfo : NotSpecified: (🙂 [Write-Error], WriteErrorException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,ConfigureRemotingForAnsible.ps1

I searched this error but I have not find a solution to it.  
for some pc when I execute ConfigureRemotingForAnsible.ps1 I have no problem but on the other the proplem persists.

if you have an idea thank you to orient me, I really need a solution to communicate with Ansible.

thank you

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [December 9, 2014, 1:31pm UTC](https://forum.ansible.com/t/problem-in-exuting-configureremotingforansible-ps1-in-windows-7/16995/2 "2014-12-09T13:31:37Z")

</div>

That error is coming from the attempt to connect back to localhost. 'd  
made changes to some of the error handling recently; previously the script  
would write an error message but continue to run.

Try commenting out line 135 (  
[https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1#L135](https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1#L135))  
to let the script continue past the error: Throw "Unable to establish an  
HTTP or HTTPS remoting session."

Please let me know if that change works for you.

---

<div class="post-metadata">

**Author:** ![youmarva](https://avatars.discourse-cdn.com/v4/letter/y/3d9bf3/32.png) [@youmarva](https://forum.ansible.com/u/youmarva)\
**Post date:** [December 9, 2014, 3:06pm UTC](https://forum.ansible.com/t/problem-in-exuting-configureremotingforansible-ps1-in-windows-7/16995/3 "2014-12-09T15:06:07Z")

</div>

I found the cause of the error, trying to run this command “enable-psremoting” :

`  
PS C:\Users\Administrateur\> enable-psremoting

Configuration rapide du service WinRM (Gestion à distance de Windows)  
La commande « Set-WSManQuickConfig » s’exécute pour activer l’administration à distance de cet ordinateur via le  
service Gestion à distance de Windows.  
Cela inclut :

1. le démarrage ou redémarrage (s’il est déjà démarré) du service Gestion à distance de Windows ;
2. l’activation du démarrage automatique du service WinRM ;
3. la création d’un écouteur pour accepter les demandes sur n’importe quelle adresse IP ;
4. l’activation des exceptions de règles de pare-feu Windows pour le trafic du service Gestion des services Web  
(trafic HTTP uniquement).

Voulez-vous continuer ?  
[O] Oui [T] Oui pour tout [N] Non [U] Non pour tout [S] Suspendre [?] Aide (la valeur par défaut est « O ») : O  
WinRM est déjà configuré pour recevoir des demandes sur cet ordinateur.  
Set-WSManQuickConfig : \<f:WSManFault xmlns:f=“[http://schemas.microsoft.com/wbem/wsman/1/wsmanfault](http://schemas.microsoft.com/wbem/wsman/1/wsmanfault)” Code=“2150859113”  
Machine=“localhost”\>\<f:

> \<f:ProviderFault provider=“Config provider”  
> path=“%systemroot%\system32\WsmSvc.dll”\>\<f:WSManFault xmlns:f=“[http://schemas.microsoft.com/wbem/wsman/1/wsmanfault](http://schemas.microsoft.com/wbem/wsman/1/wsmanfault)”  
> Code=“2150859113” Machine=“PC-slim-BH.sifast.infra”\>\<f:Message\> **L’exception de pare-feu WinRM ne fonctionnera pas car**  
> **l’un des types de connexion réseau de cet ordinateur est défini à Public. Changez le type de connexion réseau en**  
> **Domaine ou Privé, puis recommencez.** **(translation: The exception WinRM firewall will not work because**  
> **one of the types of network connections of this computer is set to Public. Change the type of network connection**  
> **Domain or Private, and then try again)** \</f:Message\>\</f:WSManFault\>\</f:ProviderFault\>\</f:Message\>\</f:WSManFault\>  
> Au caractère Ligne:69 : 17

- Set-WSManQuickConfig -force
- 

```auto

```

- CategoryInfo : InvalidOperation : (🙂 [Set-WSManQuickConfig], InvalidOperationException
- FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand  
 ![](https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif)

`

``As shown in the error The firewall exception WinRM will not work because one of the types of network connections of thoses computers is set to Public. I due Change the type of network connection Private. I followed the steps in the following link (sorry it’s in French) : [http://www.silogix.fr/changer-l’emplacement-réseau-dune-carte-dans-le-centre-réseau-et-partage.aspx](http://www.silogix.fr/changer-l%E2%80%99emplacement-r%C3%A9seau-dune-carte-dans-le-centre-r%C3%A9seau-et-partage.aspx)

But the error remains in one pc despite the change I made, but in trying to comment out line 135 ([https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1#L135](https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fansible%2Fansible%2Fblob%2Fdevel%2Fexamples%2Fscripts%2FConfigureRemotingForAnsible.ps1%23L135&sa=D&sntz=1&usg=AFQjCNGYBVDCHzRMha8BLCLpd_hJt4gyVw)) as you told me Chris Church, it’s work for me 😃

thank youuu 🙂 Chris Church

---

<div class="post-metadata">

**Author:** ![Fahd\_Ajmal](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@Fahd\_Ajmal](https://forum.ansible.com/u/Fahd_Ajmal)\
**Post date:** [March 1, 2016, 9:53pm UTC](https://forum.ansible.com/t/problem-in-exuting-configureremotingforansible-ps1-in-windows-7/16995/4 "2016-03-01T21:53:29Z")

</div>

Hi Chris,

I am getting similar error while running {ConfigureRemotingForAnsible.ps1} on some machines. I tried to look for L135 in the script but that is already a comment. can you please mention the exact line (code) that needs to be commented out?

{ # Create the hashtables of settings to be used.  
$valueset = @{} $valueset.Add(‘Hostname’, $SubjectName) $valueset.Add(‘CertificateThumbprint’, $thumbprint)}

Regards,  
Fahd

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 2, 2016, 3:58pm UTC](https://forum.ansible.com/t/problem-in-exuting-configureremotingforansible-ps1-in-windows-7/16995/5 "2016-03-02T15:58:45Z")

</div>

The script has changed a bit since Chris’s message (over a year ago).

Can you confirm you have upgraded to powershell 3 or 4 on the machines before running ConfigureRemotingForAnsible.ps1

It would help if you provide the exact error message.

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![xiao\_yu](https://avatars.discourse-cdn.com/v4/letter/x/e19b73/32.png) [@xiao\_yu](https://forum.ansible.com/u/xiao_yu)\
**Post date:** [May 30, 2017, 9:28am UTC](https://forum.ansible.com/t/problem-in-exuting-configureremotingforansible-ps1-in-windows-7/16995/6 "2017-05-30T09:28:15Z")

</div>

Hi, I have this issues when I type this command in terminal; ansible -m ping all

192.168.1.2 | UNREACHABLE! =\> {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"changed": false,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"msg": "ssl: HTTPSConnectionPool(host='192.168.1.2', port=5986): Max retries exceeded with url: /wsman(Caused by ConnectTimeoutError(\<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f934053f890\>, 'Connection to 192.168.1.2 timed out. (connnect timeout=30)'))",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"unreachable": true  
}  
192.168.12 | UNREACHABLE! =\> {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"changed": false,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"msg": "Authentication failure.",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"unreachable": true

I did this steps:  
 sudo apt install python-pip  
 sudo pip install “pywinrm\>=0.1.1”  
 sudo apt-get install libkrb5-dev  
 sudo pip install kerberos

then edit /etc/ansible/hosts and add this:  
[windows]  
192.168.1.2

[web]  
192.168.1.12

[windows:vars]  
ansible\_ssh\_user="Administrator"  
ansible\_ssh\_pass=123456  
ansible\_ssh\_port=5986  
ansible\_connection="winrm"  
ansible\_winrm\_server\_cert\_validation = "ignore"

Next edit /etc/nsible/ansible.cfgs  
look for “ask\_pass = True” and delete “#”.
