# system.opc.getServers() returns different results Perspective v.s. Vision

**URL:** <https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663>\
**Category:** Ignition Early Access\
**Tags:** ignition80, perspective\
**Created:** [December 12, 2019, 3:38pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663 "2019-12-12T15:38:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhottell](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jhottell/32/6472_2.png) [@jhottell](https://forum.inductiveautomation.com/u/jhottell)\
**Post date:** [December 12, 2019, 3:38pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/1 "2019-12-12T15:38:04Z")

</div>

I am puzzled that system.opc.getServers() in Ignition **8.0.6 Stable (b2019111216)** returns different results when executed from a button in Perspective versus Vision. In perspective it does not return disabled OPC server connections. Maybe I am missing something.

```auto
# Perspective button example
headers = ["OPCServer", "ServerState"]
data = []
servers = system.opc.getServers()
if not servers:
    print "No servers found"
    data.append(['No servers found', 'unknown'])
else:
    for server in servers:
        data.append([server, system.opc.getServerState(server)])
self.getSibling("OPCServerTable").props.data = system.dataset.toDataSet(headers, data)	

# Vision button example
headers = ["OPCServer", "ServerState"]
data = []
servers = system.opc.getServers()
if not servers:
	print "No servers found"
	data.append(['No servers found'])
else:
	for server in servers:
		print server
		data.append([server, system.opc.getServerState(server)])
print data
event.source.parent.getComponent('Table').data = system.dataset.toDataSet(headers, data)	

```

 ![2019-12-12_9-32-07](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1c418628f7f1f89fe5f972e639b0b272c83ff9b3.png)

Thanks!

---

<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:** [December 12, 2019, 4:06pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/2 "2019-12-12T16:06:16Z")

</div>

Huh, yep, gateway vs client scope has different implementations (perspective is gateway scope).

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 12, 2019, 4:38pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/3 "2019-12-12T16:38:32Z")

</div>

The good news is this is a known bug. The bad news is that it’s on a pretty low priority backlog. I added this thread, which may help kick it to a higher priority tier.

---

<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:** [April 9, 2020, 7:31pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/4 "2020-04-09T19:31:30Z")

</div>

I’m gonna bump this, as I just ran into this on 8.0.9. I have a script that checks for disabled servers and re-enables them. As you can imagine, that doesn’t work.

I worked around it by specifically naming them, but it goes against my sense of lazy. 🙂

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 9, 2020, 7:33pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/5 "2020-04-09T19:33:11Z")

</div>

Well, the bad news is that the ticket suggests `getServers` shouldn’t return disabled servers in any scope, so…

---

<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:** [April 9, 2020, 7:42pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/6 "2020-04-09T19:42:59Z")

</div>

If that is so, then some of the usefulness of system.opc for server information gets crippled. 🤷‍♂️

---

<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:** [April 9, 2020, 8:05pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/7 "2020-04-09T20:05:54Z")

</div>

Maybe we can make it take a keyword arg parameter `includeDisabled` that defaults to false if not specified.

This would keep all the existing function calls working (though not how you wish), but there’d be a new parameter to let you get disabled servers as well.

---

<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:** [October 8, 2020, 12:36pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/8 "2020-10-08T12:36:03Z")

</div>

This was implemented and released in 8.0.14.

---

<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:** [September 8, 2021, 1:28pm UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/9 "2021-09-08T13:28:37Z")

</div>

Any chance to make it work on 7.9.17 ? we are not yet ready to move to v8 and we would like to use it our project as soon as possible

---

<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:** [September 9, 2021, 5:47am UTC](https://forum.inductiveautomation.com/t/system-opc-getservers-returns-different-results-perspective-v-s-vision/30663/10 "2021-09-09T05:47:15Z")

</div>

Never mind. I manage to find a solution to skip the problem. Instead of getting the list of servers by calling the system.opc.getServers() I just use this piece of code:

```auto
tags = system.tag.browseTagsSimple("[System]Gateway/OPC/Connections","ASC")
OPCServers=[]
for tag in tags:
	if tag.isFolder():
		OPCServers.append(tag.name)

```
