Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/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://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

[bug] Cant do reverse connect via automated task (scheduler)

Post Reply
AnotherUVNCuser
40
40
Posts: 68
Joined: 2017-09-13 00:40

[bug] Cant do reverse connect via automated task (scheduler)

Post by AnotherUVNCuser »

Hello all (and Rudi) :-)


The following has been tested using 1.2.1.6, under a virtual Windows 7 Home Basic Edition (x86) and a real Windows 10 Pro (x64)


I wanted to execute a reverse connection to my own computer via an automated task (Windows Task Scheduler).
The task gets executed but nothing happens.

For your information:

The Task Scheduler does NOT execute WINVNC -connect HOSTNAME/IP directly,
but runs a self compiled commandline .exe, that i've made using http://orwelldevcpp.blogspot.be/ and http://www.codeblocks.org/

Code: Select all

#include <windows.h>
//#include <winver.h>

using namespace std;

int main() {

//	system("NETSTAT -N | FINDSTR /I ESTABLISHED | FINDSTR :1234 >NUL || winvnc.exe -connect 192.168.0.226:1234");
	system("winvnc.exe -connect 192.168.0.226");
	return 0;

}
With TightVNC this works fine, but with UltraVNC it doesn't do anything.

Hopefully this can be fixed, as i intent to run multiple commands on a scheduled/repeating time and want to do this via an .exe, so that i don't have to add more stuff to the task scheduler (i prefer this method over a .bat/.cmd).
With the automated task i can manage my computers when i'm not at home, without having to manually connect to them (call me lazy, i find it convenient :mrgreen:).

Also (to eliminate any misunderstandings): the server connects to the correct address, the 192. was purely entered as an example and i also use encryption/authentication.


EDIT: 1.2.1.7 is also affected

/AnotherUVNCuser
Last edited by AnotherUVNCuser on 2017-10-01 16:43, edited 6 times in total.
AnotherUVNCuser
40
40
Posts: 68
Joined: 2017-09-13 00:40

[bug] Cant do reverse connect via automated task (scheduler)

Post by AnotherUVNCuser »

I have recorded a video in which i demonstrate the (reproducable) problem (1.2.1.7 is also affected):

https://www.youtube.com/watch?v=P4tpjXDbGX8
AnotherUVNCuser
40
40
Posts: 68
Joined: 2017-09-13 00:40

Re: [bug] Cant do reverse connect via automated task (schedu

Post by AnotherUVNCuser »

The problem with the non running task really appears to be related to session 0 (SYSTEM) :/

Isn't it possible to make it compatible with the Windows SYSTEM account?

Besides trying the system(); C++ directive i've also tried the following (of which both methods fail when trying to run them from a SYSTEM task):

ShellExecute

Code: Select all

#include <windows.h>

// using namespace std;

int main()

{

	ShellExecute(0, "open", "winvnc.exe", "-connect 192.168.0.226:1234", 0, 1);

	return 0;

}

CreateProcess

Code: Select all

#include <windows.h>

// using namespace std;

int main()

{
	HWND				hWnd;
	STARTUPINFO			sInfo;
	PROCESS_INFORMATION	pInfo;

	ZeroMemory(&sInfo, sizeof(sInfo));
	sInfo.cb = sizeof(sInfo);
	ZeroMemory(&pInfo, sizeof(pInfo));

	char cmdArgs[] = " -connect 192.168.0.226:1234";

	if(CreateProcess("winvnc.exe", cmdArgs, NULL, NULL, false, 0, NULL, NULL, &sInfo, &pInfo));

    { 
//        WaitForSingleObject(pInfo.hProcess,INFINITE);

        CloseHandle(pInfo.hThread);
        CloseHandle(pInfo.hProcess);

    }  

    return 0;

}
EDIT: After some more testing, i've came to a possible solution (i don't want to call it a workaround just yet).

I've noticed that i can make the task work when choosing a different built in account, i.e. SID: S-1-5-32-545, which is the built in users account.

(found here: https://support.microsoft.com/nl-nl/hel ... ng-systems )

Using this account, i only don't know if it can connect to me without me having to log on first (which would defeat its purpose of my usage goal).
Tki2001
8
8
Posts: 22
Joined: 2016-04-24 11:44

Re: [bug] Cant do reverse connect via automated task (schedu

Post by Tki2001 »

It should be the same account permission issue, as the UltraVNC has when it is not permitting the installation on a remote desktop session (well, it is, but not running correctly after install).
It is just because the permissions are not the same, that the user it is running the task.
Try to run the task under the same user, the UltraVNC has installed its files.
Take into account, that before login in, there's no user interaction, as desktop has not been loaded.
The server is running fine before loggin in, and permits connections, but I don't know if client permits execution without a user logged in.
Post Reply