How to write a relevance of a running service?

(imported topic written by bigbao91)

i want to write a relevance to select pc which is running a server of “VNC service”.i write that:

exists service “VNC Server” whose (state of it = “Running”)

but it dose not work.Can anyone kindly tell me how to write the correct one?

1 Like

(imported comment written by BenKus)

Hi BigBao,

That looks right… Maybe the service name is not “VNC Server”?

If you open your services and double-click on the service name, what is it? Or run:

service name of services whose (service name of it as lowercase contains “vnc”)

Ben

(imported comment written by bigbao91)

hi, ben

i use

service name of services whose (service name of it as lowercase contains “vnc”)

it shows “winvnc” which works.“VNC Server” is only a display name.

but i have another question how i can find clients whose port (such as 5900) is opened?

(imported comment written by BenKus)

Hi bigbao,

When you refer to services by name, you need to use their “service name” rather than their “display name”… so you would say something like:

exists running service “winvnc”

For the listening port, we don’t have direct inspectors for that in the current version and so you will need to write an action that writes out netstat values to a file… something like this:

waithidden cmd.exe /C netstat -an > “{pathname of parent folder of regapp “besclient.exe”}\netstat.txt”

And then you can run that action on the computer and then you can write a property that says something like:

exists line whose (it as lowercase contains “listening” and it contains “:5900”) of file “netstat.txt” of parent folder of regapp “BESClient.exe”

Ben

(imported comment written by SystemAdmin)

This is the one I created and has been working very well. Not sure if it could be written any more efficiently - but it does the job.

if (exists service “winvnc4”) then state of service “winvnc4” else “”

(imported comment written by bigbao91)

thanks ben and mgoodnow,

i find

exists line whose (it as lowercase contains “listening” and it contains “:5900”) of file “netstat.txt” of parent folder of regapp “BESClient.exe”

use more less time than

exists running service “winvnc”

.

(imported comment written by SystemAdmin)

I do not find the “netstat.txt” file loaded anywhere on any systems running Enterprise VNC.

Where is your file located?

Mike

(imported comment written by BenKus)

Hi Mike,

You first need to run a separate action to output the results of an netstat call to a file… This is the action you will run:

waithidden cmd.exe /C netstat -an > “{pathname of parent folder of regapp “besclient.exe”}\netstat.txt”

Ben

2 Likes