# Open and Close WinRM shells with each task?

**URL:** <https://forum.ansible.com/t/open-and-close-winrm-shells-with-each-task/30675>\
**Category:** Ansible Project\
**Created:** [June 27, 2019, 7:24pm UTC](https://forum.ansible.com/t/open-and-close-winrm-shells-with-each-task/30675 "2019-06-27T19:24:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Wyatt](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@Tony\_Wyatt](https://forum.ansible.com/u/Tony_Wyatt)\
**Post date:** [June 27, 2019, 7:24pm UTC](https://forum.ansible.com/t/open-and-close-winrm-shells-with-each-task/30675/1 "2019-06-27T19:24:36Z")

</div>

We have noticed as we develop more and more complex plays that our Tower connections to inventory seem to be open/closed per task.

Is this “by design”?

What, if any, options can we specify to afford fewer WinRM sessions per task/play/role, etc?

-T

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [June 27, 2019, 8:23pm UTC](https://forum.ansible.com/t/open-and-close-winrm-shells-with-each-task/30675/2 "2019-06-27T20:23:28Z")

</div>

It is mostly by design as that’s how the connection plugins are initialised. Each connection plugin is created post fork for each task executed which means we need to open a WinRM shell then close it for every task.

We’ve been toying with the idea of connection persistence for a while but nothing has come out of it so far. Potentially a change in the future but there are no guarantees.

Thanks

Jordan
