# Change the ports of a modbus device by script

**URL:** <https://forum.inductiveautomation.com/t/change-the-ports-of-a-modbus-device-by-script/20969>\
**Category:** Ignition\
**Created:** [November 20, 2018, 1:52pm UTC](https://forum.inductiveautomation.com/t/change-the-ports-of-a-modbus-device-by-script/20969 "2018-11-20T13:52:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![florent.gelas](https://avatars.discourse-cdn.com/v4/letter/f/4da419/32.png) [@florent.gelas](https://forum.inductiveautomation.com/u/florent.gelas)\
**Post date:** [November 20, 2018, 1:52pm UTC](https://forum.inductiveautomation.com/t/change-the-ports-of-a-modbus-device-by-script/20969/1 "2018-11-20T13:52:10Z")

</div>

Hello,

I would like to know if it’s possible to change the ports of a mobus device.  
I have found a solution for the hostname but nothing for the ports

myDevices = system.device.listDevices()  
system.device.setDeviceHostname(deviceName,ipAddress)

Thanks

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 21, 2018, 3:00pm UTC](https://forum.inductiveautomation.com/t/change-the-ports-of-a-modbus-device-by-script/20969/2 "2018-11-21T15:00:03Z")

</div>

I don’t think there is a current mechanism for editing devices, outside of what you’ve already seen. Looks like you would have to remove, then add the device back in.

---

<div class="post-metadata">

**Author:** ![florent.gelas](https://avatars.discourse-cdn.com/v4/letter/f/4da419/32.png) [@florent.gelas](https://forum.inductiveautomation.com/u/florent.gelas)\
**Post date:** [November 23, 2018, 1:10pm UTC](https://forum.inductiveautomation.com/t/change-the-ports-of-a-modbus-device-by-script/20969/3 "2018-11-23T13:10:38Z")

</div>

Thank you, That’s what I tought.  
This is a pity because it is possible to change all the parameters from the Gateway and only a few per script.
