# Can we dynamically enable/disable device connections?

**URL:** <https://forum.inductiveautomation.com/t/can-we-dynamically-enable-disable-device-connections/29900>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [November 13, 2019, 2:15am UTC](https://forum.inductiveautomation.com/t/can-we-dynamically-enable-disable-device-connections/29900 "2019-11-13T02:15:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neo](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@Neo](https://forum.inductiveautomation.com/u/Neo)\
**Post date:** [November 13, 2019, 2:15am UTC](https://forum.inductiveautomation.com/t/can-we-dynamically-enable-disable-device-connections/29900/1 "2019-11-13T02:15:36Z")

</div>

We are connecting to a device using TCP driver on a port. We need to close this connection after completion of process, so another gateway can connect to this device on same port.  
Is it possible to enable/disable device connection using scripting?.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/cd9daa64ebc9cce75559a0d5d7f8edb2fd18cc74.png)

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [November 13, 2019, 2:29am UTC](https://forum.inductiveautomation.com/t/can-we-dynamically-enable-disable-device-connections/29900/2 "2019-11-13T02:29:57Z")

</div>

**system.device.setDeviceEnabled(deviceName, enabled)**

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 13, 2019, 2:29am UTC](https://forum.inductiveautomation.com/t/can-we-dynamically-enable-disable-device-connections/29900/3 "2019-11-13T02:29:58Z")

</div>

Sure: [https://docs.inductiveautomation.com/display/DOC80/system.device.setDeviceEnabled](https://docs.inductiveautomation.com/display/DOC80/system.device.setDeviceEnabled)

edit: Jae wins!

---

<div class="post-metadata">

**Author:** ![Neo](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@Neo](https://forum.inductiveautomation.com/u/Neo)\
**Post date:** [November 13, 2019, 3:29am UTC](https://forum.inductiveautomation.com/t/can-we-dynamically-enable-disable-device-connections/29900/4 "2019-11-13T03:29:19Z")

</div>

Thank you @jpark @Kevin.Herron for your quick reply
