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

exit status

Post Reply
coudy
Posts: 6
Joined: 2014-08-18 11:28

exit status

Post by coudy »

Hi, is there any exit status ?
I have tried, bud does not found anything about exit statuses.

Code: Select all

u:\rConnect>uvncviewer.exe

u:\rConnect>echo %ERRORLEVEL%
0

u:\rConnect>uvncviewer.exe /sdfa

u:\rConnect>echo %ERRORLEVEL%
0

u:\rConnect>uvncviewer.exe /sdfa

u:\rConnect>echo %ERRORLEVEL%
0

u:\rConnect>echo %ERRORLEVEL%
0
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6839
Joined: 2004-04-23 10:21
Contact:

Re: exit status

Post by Rudi De Vos »

no, we didn't set any return value on error.
coudy
Posts: 6
Joined: 2014-08-18 11:28

Re: exit status

Post by coudy »

and will you add this feature ?
Bonji
100
100
Posts: 339
Joined: 2008-05-13 14:54

Re: exit status

Post by Bonji »

What are you trying to accomplish exactly coudy?
-Ben
coudy
Posts: 6
Joined: 2014-08-18 11:28

Re: exit status

Post by coudy »

I have several clients, but with different two passwords.
I want to automatize connecting to this host.
1. Connect to host1 with pwd1
2. on error connect to host1 with pwd2

I want to use windows batch script with %ERRORLEVEL% option
Bonji
100
100
Posts: 339
Joined: 2008-05-13 14:54

Re: exit status

Post by Bonji »

Assuming you can ping the computer, here's an attempt to accomplish what you want.

There's a 6 second wait in the script to allow time to close the prompt notifying that the password was wrong. If it is not closed in time, it cannot read the log file to determine if the previous attempt was successful or not. If you cannot test if the computer is online prior to connecting with uVNC, then you'll likely need to increase the wait time to 25+ seconds to account for the viewer timeout.

The script could also be modified to connect to the computer twice using each password so you don't have to deal with closing the prompt, but you will have to eventually close out of the window that used the wrong password. If you know what computers have which password, then you could query two different files of computer names and use the correct password out of the gate.

Code: Select all

@Echo Off

If %11 == 1 Goto NoIP
Set IPAddr=%1

Ping %IPAddr% -n 1 > NUL
If %ErrorLevel% EQU 1 (Goto:OFFLINE) else (echo Computer ONLINE)

Start C:\Data\VNCViewer.exe /password Password1 /logfile uVNC.log %IPAddr%
Choice /N /T 6 /D Y /M "Connecting with 1st password..."
Find /I "VNC authentication failed!" uVNC.log > NUL
Del uVNC.log
If %ErrorLevel% == 1 Goto End
If %ErrorLevel% == 0 Goto Auth2

:Auth2
Echo Connecting with 2nd password...
Start C:\Data\VNCViewer.exe /password Password2 %IPAddr%
Goto End

:NoIP
Echo.
Echo No IP address was specified
Echo.
Echo.
Goto End

:OFFLINE
Echo.
Echo The computer (%IPAddr%) is currently unreachable
Echo.
Echo.
Goto End

:End
[EDIT1] I swapped the two If %ErrorLevel% lines as I had them backwards.

[EDIT2] Working on a problem where it always tries to connect with the 2nd password when the 1st password worked and connected. Meh, sometimes it does that and sometimes it doesn't depending on when the viewer executable releases the lock on the log file. If nothing else, this is a start of a solution. :)
-Ben
coudy
Posts: 6
Joined: 2014-08-18 11:28

Re: exit status

Post by coudy »

Hi,
this does not solve my problem, because it always open vnc windows and show mi error about "Authentification failed"
I can do it same when I run twice vncviewer, with password1 and password2.

What I want, is do not show error window when authentification failed.
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6839
Joined: 2004-04-23 10:21
Contact:

Re: exit status

Post by Rudi De Vos »

The vncviewer is gui based, all errors are showed via popups.
It looks like you need return codes and all gui stuff removed....this is a lot of work.
Perhaps when i have a lot of time ...but this is nothing with high priority.
Bonji
100
100
Posts: 339
Joined: 2008-05-13 14:54

Re: exit status

Post by Bonji »

Do you know which computers use which password? If so, you can create a file that details that information, query it, then use the correct password the first time, every time.
-Ben
coudy
Posts: 6
Joined: 2014-08-18 11:28

Re: exit status

Post by coudy »

@Bonji no, it is random, it depends on disk image version
coudy
Posts: 6
Joined: 2014-08-18 11:28

Re: exit status

Post by coudy »

@Rudi De Vos I have tried so many windows vnc clients, some post error codes, some don't, but none of them have parameter something like /quiet or /batch, which will block all popups.
If you implement this switch, it will be fine for me.
Bonji
100
100
Posts: 339
Joined: 2008-05-13 14:54

Re: exit status

Post by Bonji »

As a work-around, if you can figure out anything that distinguishes the two images apart, you can check for that in the script and then use the appropriate password.

Also, if you have remote management of the machines in question (really just remote file access), you could replace their ultravnc.ini with a common one as to unify the password across them all. Another option would be to push new settings such that it uses AD authentication (if available) and then you can use local or domain credentials to connect.
-Ben
Post Reply