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

Uninstall service + logoff on client computer - solved

Simple, Free, Open Source UltraVNC Wrapper Supporting Windows and Mac OSX
Post Reply
JonD
40
40
Posts: 121
Joined: 2006-12-24 16:46
Location: Canada

Uninstall service + logoff on client computer - solved

Post by JonD »

When finished working with a client computer I want to uninstall the service and leave the computer in a logged off state or rebooted state.

I've increased the delay from 15sec but I'm still uncertain about how it would work reliably

1. close down all running programs on client computer
2. start the uninstall process
3. start the logoff or reboot

Is there anyway to be sure the uninstall succeeds before the logoff/reboot kicks in?

A reboot with a "run once" ChunkVNC process comes to mind as an alternative.

JonD
Last edited by JonD on 2010-10-25 19:23, edited 1 time in total.
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: Uninstall service + logoff on client computer

Post by supercoe »

You could edit the SRC\ChunkVNC.au3 which controls the service install and uninstall to do a SHUTDOWN command in -t seconds.

Code: Select all

c:\>shutdown /?
Usage: SHUTDOWN [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c
omment"] [-d up:xx:yy]

       No args                 Display this message (same as -?)
       -i                      Display GUI interface, must be the first option
       -l                      Log off (cannot be used with -m option)
       -s                      Shutdown the computer
       -r                      Shutdown and restart the computer
       -a                      Abort a system shutdown
       -m \\computername       Remote computer to shutdown/restart/abort
       -t xx                   Set timeout for shutdown to xx seconds
       -c "comment"            Shutdown comment (maximum of 127 characters)
       -f                      Forces running applications to close without warning
       -d [u][p]:xx:yy         The reason code for the shutdown
                               u is the user code
                               p is a planned shutdown code
                               xx is the major reason code (positive integer less than 256)
                               yy is the minor reason code (positive integer less than 65536)

Sorry I don't have a better answer, would require some coding on your part.
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
JonD
40
40
Posts: 121
Joined: 2006-12-24 16:46
Location: Canada

Re: Uninstall service + logoff on client computer

Post by JonD »

That sounds like a very good solution. I think I'll play with creating 2 versions of ChunkVNC so that there's an option without the shutdown action.

I just need for security reasons, to leave an unattended machine in a relatively secure mode after I finish and I don't want the service left installed.

JonD
JonD
40
40
Posts: 121
Joined: 2006-12-24 16:46
Location: Canada

Re: Uninstall service + logoff on client computer

Post by JonD »

How about using autoit shutdown vs shellexecute shutdown?

The windows shutdown does have some extra options but perhaps the autoit shutdown will handle different OS's better?

Any thoughts on this?

JonD
JonD
40
40
Posts: 121
Joined: 2006-12-24 16:46
Location: Canada

Re: Uninstall service + logoff on client computer

Post by JonD »

Well that was fairly easy... thanks to supercoe for the suggestion:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Code: Select all

Else
	If MsgBox( 4, "wdHelp", "Remove Service and Uninstall?" ) = 6 Then
		$UninstallMsg = "Please close the viewer now, uninstall will continue in 15 seconds..."
		If MsgBox( 4, "", "Reboot computer after Uninstall?" ) = 6 Then
			$Reboot = True
            $UninstallMsg = "Please close the viewer now, uninstall/reboot will continue in 15 seconds..."
		Else
			$Reboot = False
		endif

		; Allow viewer to disconnect to prevent schook.dll locking.
		MsgBox( 0, "Information", $UninstallMsg, 15 )

		; Uninstall service.
		ShellExecute( $ChunkVNCPath & "\InstantSupportVNC.exe", "-uninstall" )

		; Wait for InstantSupportVNC.exe to end.
		ProcessWaitClose( "InstantSupportVNC.exe", 10 )

		;no longer used because I create a desktop bat instead
		;FileDelete( @DesktopCommonDir & $wdHelpLnk )

        ; Remove files... use RunWait not Run in _SelfDelete
		; ChunkVNC.exe will remain since it is the running program
		_SelfDelete(5)

		; wait 15 seconds
		Sleep(15000)
		If $Reboot Then
			ShellExecute("shutdown.exe"," -r -f -t 60", @SystemDir)
		EndIf
	EndIf
EndIf
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: Uninstall service + logoff on client computer

Post by supercoe »

JonD wrote:Well that was fairly easy... thanks to supercoe for the suggestion:
Good, that was the idea of keeping the project open source. :D
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
Post Reply