# OPC-UA connections by script

**URL:** <https://forum.inductiveautomation.com/t/opc-ua-connections-by-script/33202>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [March 18, 2020, 12:00pm UTC](https://forum.inductiveautomation.com/t/opc-ua-connections-by-script/33202 "2020-03-18T12:00:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lettierf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lettierf/32/7431_2.png) [@lettierf](https://forum.inductiveautomation.com/u/lettierf)\
**Post date:** [March 18, 2020, 12:00pm UTC](https://forum.inductiveautomation.com/t/opc-ua-connections-by-script/33202/1 "2020-03-18T12:00:02Z")

</div>

Hi all  
is there a way to:

1. Take all the information from the current configured OPC-UA server connections (at least the end-points and the names
2. Create the OPC-UA connections by script starting from the info gathered at point #1

I am able to do it easily with the devices but at now I can’t find any script to do the same with OPC-UA server connections  
Thanks

---

<div class="post-metadata">

**Author:** ![Sunny](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sunny/32/13319_2.png) [@Sunny](https://forum.inductiveautomation.com/u/Sunny)\
**Post date:** [March 18, 2020, 12:39pm UTC](https://forum.inductiveautomation.com/t/opc-ua-connections-by-script/33202/2 "2020-03-18T12:39:13Z")

</div>

1-The script function [system.opc.getServers()](https://docs.inductiveautomation.com/display/DOC80/system.opc.getServers) will give you their names, and maybe you can retrieve its endpoint from the taglist  
2-It is a lot harder to make the proper connection with a OPC-UA server/client then it is with the device due to the certificates exchange and trust. The designer don’t give an easy way to do so, probably because of the certificates jimbo jambo. They would be some workarounds, but nothing that I recommend for stability sake of your gateway.  
Although, I’m curious at to why not have all those connection setup already on your gateway. I would prefer an unused OPC-UA connection then the scripting you are trying to achieve here. Worst case scenario, just toggle the _enable_ propertie of the server.

---

<div class="post-metadata">

**Author:** ![lettierf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lettierf/32/7431_2.png) [@lettierf](https://forum.inductiveautomation.com/u/lettierf)\
**Post date:** [March 18, 2020, 1:02pm UTC](https://forum.inductiveautomation.com/t/opc-ua-connections-by-script/33202/3 "2020-03-18T13:02:32Z")

</div>

Thanks for the reply  
this kind of stuff with devices and OPC servers connections are useful when you have to move a project to another gateway but you don’t want to move the entire gateway backup. With the devices is quite easy as you can store all the info in a dataset and use it to script the creation of the new devices. For OPC Server connection is something you have to do one by one manually

---

<div class="post-metadata">

**Author:** ![Sunny](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sunny/32/13319_2.png) [@Sunny](https://forum.inductiveautomation.com/u/Sunny)\
**Post date:** [March 18, 2020, 1:08pm UTC](https://forum.inductiveautomation.com/t/opc-ua-connections-by-script/33202/4 "2020-03-18T13:08:22Z")

</div>

The certificate should differ from one gateway to another for security reason. So this procedure you are trying to attempt wouldn’t work either way. I think spinning a sort of snapshot of the gateway with the possible transfering items could be a way to go.

---

<div class="post-metadata">

**Author:** ![lettierf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lettierf/32/7431_2.png) [@lettierf](https://forum.inductiveautomation.com/u/lettierf)\
**Post date:** [March 18, 2020, 1:16pm UTC](https://forum.inductiveautomation.com/t/opc-ua-connections-by-script/33202/5 "2020-03-18T13:16:04Z")

</div>

agree, but if it’s possible to get rid of the certs by using a straight connection…it can be done . I am going to send out a mail to technical support of Inductive. There can be a workaround on this

---

<div class="post-metadata">

**Author:** ![Sunny](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sunny/32/13319_2.png) [@Sunny](https://forum.inductiveautomation.com/u/Sunny)\
**Post date:** [March 18, 2020, 1:18pm UTC](https://forum.inductiveautomation.com/t/opc-ua-connections-by-script/33202/6 "2020-03-18T13:18:07Z")

</div>

You can remove the user credential for login, but the certs are required. They are the security set by the OPC-UA protocol.
