Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://twitter.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

Connect to VNC Viewer from Windows Service

Post Reply
kb00
Posts: 2
Joined: 2017-09-15 11:14

Connect to VNC Viewer from Windows Service

Post by kb00 »

Hi All,

I'd like to ask for your help, as I have been struggling with this issue for a while. Maybe someone can help me:

I have a vncviewer.exe started locally, listening on port 5900 (vncviewer.exe -listen 5900)
I would like to set up a connection to this viewer by initiating the connection from the UltraVNC Server. However, I'd like to do that by starting the connection from a Windows Service.

I started the server with this command (this works perfectly fine from my Windows Service as well. uvnc_service gets started, I can see its systray and everything):

Code: Select all

winvnc.exe -startservice
Then, I try to connect with this one:

Code: Select all

winvnc.exe -connect localhost::5900 -service
Problem is: The last command above works perfectly, if issued from cmd. It also works if I call this from a regular .NET application. But if the same application is installed as a service, nothing happens. My service is running as current user (same as cmd).

Could you tell me what could be the problem, maybe give me some hint where to look around? Or if my commands should work at all?

Many thanks,
kb00

Related .NET code:

Code: Select all

processServer = new Process();
processServer.StartInfo = new ProcessStartInfo
{
         FileName = "C:\\Users\\myUser\\Documents\\UltraVNC\\winvnc.exe",
         Arguments = "-autoreconnect - connect localhost::5900 - service"
};
processServer.Start();
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6832
Joined: 2004-04-23 10:21
Contact:

Re: Connect to VNC Viewer from Windows Service

Post by Rudi De Vos »

vncviewer -listen

Default server listen to 5900 and viewer to 5500

1) Click try icon, add new connection
Hostname [pc running viewer]

You can use any port
viewer -listen 5505
Hostname [ip:5505]

2)
winvnc.exe -autoreconnect - connect viewer_ip::5505

If the commandline works add to the ultravnc.ini file
[admin]
service_commandline=-autoreconnect - connect viewer_ip:5505

Now you can start/stop the service and he autoconnect to the veiwer
kb00
Posts: 2
Joined: 2017-09-15 11:14

Re: Connect to VNC Viewer from Windows Service

Post by kb00 »

Hello,

thanks Rudi. Both of the methods you described working perfectly.

However, I was looking for a way to start sessions in an automated way from my Windows service using command line without having to modify the ultravnc.ini file (or using the GUI).

But if there are no other options, I'll just use the second method.

Thanks again,
kb00
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6832
Joined: 2004-04-23 10:21
Contact:

Re: Connect to VNC Viewer from Windows Service

Post by Rudi De Vos »

Sorry, no other methods
Post Reply