From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

For installing the mirror driver in Win7-64bit, I use this batch. For more information on the method, see this post in the uvnc-forum. Information how to get the certificate for the driver can be found in this post.

@echo off
REM see

REM install certificate for driver
set PATH=%~dp0
REM how to get the certificate see
start /w "install certificate" %PATH%\certmgr.exe -add %PATH%\uvnc.cer -c -s -r localMachine TrustedPublisher

REM install driver
robocopy /Z /S /NP /NDL /NFL /NJH /NJS \\ptw.local\ptw\SWVerteil\WPKG\packages\ultravnc\driver "c:\Program Files (x86)\UltraVNC\driver\driver"
cd "c:\Program Files (x86)\UltraVNC\driver\driver\"
start /w "install mirror driver" devcon.exe install mv2.inf mv_hook_display_driver2

For installing vnc itself, I create a msi with vnced --Konus 22:39, 28 December 2011 (CET)

here is the package I use (for 64 bit OS)

<?xml version='1.0' encoding='utf-8'?>
		<variable name="version" value="" />
		<variable name="shortversion" value="" />
		<check type='uninstall' condition='exists' path='UltraVNC'/>
		<check type='file' condition='versionequalto' path='%PROGRAMFILES(x86)%\UltraVNC\winvnc.exe' value='%shortversion%'/>
		<check type='file' condition='exists' path='%PROGRAMFILES(x86)%\UltraVNC\ultravnc.ini' />
		<check type='execute' path='findstr /R /C:"passwd=$" "%PROGRAMFILES(x86)%\UltraVNC\ultravnc.ini" > NUL' condition='exitcodeequalto' value='1' />
		<!-- <check type='execute' path='%ComSpec% /c netsh firewall show allowedprogram | find /I "winvnc.exe" > NUL' condition='exitcodeequalto' value='0' /> -->
			<command type="install" cmd='"%SOFTWARE%\ultravnc\install.cmd"'/>
			<command type="install" cmd='%windir%\system32\msiexec.exe /quiet /qn /i "%SOFTWARE%\ultravnc\UltraVNC_64bit_%version%.msi" ' />
			<command type="upgrade" cmd='"%SOFTWARE%\ultravnc\install.cmd"'/>
			<command type="upgrade" cmd='%windir%\system32\msiexec.exe /quiet /qn /i "%SOFTWARE%\ultravnc\UltraVNC_64bit_%version%.msi" ' />
			<command type="remove" cmd='"%SOFTWARE%\ultravnc\remove.cmd"'/> <!-- diese Datei muss noch angelegt werden, bevor UltraVNC deinstalliert wird -->

--Konus 16:20, 6 January 2012 (CET)


the winvnc.exe -remove popup a dialogbox saying "The WinVNC service has been unregistered".

Is there a way to avoid this message ?

You could 1) start that command in the background, 2) wait several seconds, 3) kill the process displaying the windows with taskkill command
WPKGSysop 16:22, 15 April 2008 (CEST)

I found a best way to do this, just install the service and the service helper manually:

<?xml version='1.0' encoding='utf-8'?>

    <check type='uninstall' condition='exists' path='UltraVNC v1.0.2'/>

    <install cmd='%SOFTWARE%\vnc\ultravnc-102-setup.exe /verysilent /loadinf="%SOFTWARE%\vnc\ultravnc.inf"'/>

    <!-- Setup the password and the option -->
    <install cmd='regedit /s %SOFTWARE%\vnc\ultravnc.reg'/>

    <!-- Add the service helper manually -->
    <install cmd='reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v WinVNC /d "\"%ProgramFiles%\UltraVNC\winvnc.exe\" -servicehelper"'/>

    <!-- Create the "VNC server" service manually, add Tcpip dependency not used by auto-installation -->
    <install cmd='sc create WinVNC binPath= "\"%ProgramFiles%\UltraVNC\winvnc.exe\" -service" type= own type= interact start= auto error= severe depend= Tcpip DisplayName= "VNC Server"'/>

    <!-- enable winvnc.exe for the firewall -->
    <install cmd='netsh firewall add allowedprogram "%ProgramFiles%\UltraVNC\winvnc.exe" "WinVNC server" enable all'/>
    <install cmd='net stop WinVNC'>
      <exit code='0'/>
      <exit code='2'/>
    <install cmd='net start WinVNC'/>

    <upgrade cmd='net stop WinVNC'>
      <exit code='0'/>
      <exit code='2'/>
    <upgrade cmd='%SOFTWARE%\vnc\ultravnc-102-setup.exe /verysilent /loadinf="%SOFTWARE%\vnc\ultravnc.inf"'/>
    <upgrade cmd='regedit /s %SOFTWARE%\vnc\ultravnc.reg'/>
    <upgrade cmd='net start WinVNC'/>

    <remove cmd='net stop WinVNC'>
      <exit code='0'/>
      <exit code='2'/>
    <remove cmd='sc delete WinVNC'/>
    <remove cmd='netsh firewall del allowedprogram "%ProgramFiles%\UltraVNC\winvnc.exe"'/>
    <remove cmd='"%ProgramFiles%\UltraVNC\unins000.exe" /VERYSILENT /SUPPRESSMSGBOXES'/>

    <!-- The remove seems to not remove generated files -->
    <remove cmd='%ComSpec% /c rd /S /Q "%ProgramFiles%\UltraVNC"'/>

    <!-- remove unused registery keys -->
    <remove cmd='reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v WinVNC /f'/>
    <remove cmd='reg delete HKLM\Software\ORL /f'/>
    <remove cmd='reg delete HKU\.DEFAULT\Software\ORL /f'/>


With ultravnc.inf as follow:

Dir=C:\Program Files\UltraVNC

Note that ultravnc.inf does not support variables.

The ultravnc.reg is just a regdump of HKEY_LOCAL_MACHINE\SOFTWARE\ORL, I use the following perl script to generate the password key:

#!/usr/bin/perl -w

use strict;
use warnings;

use Getopt::Long;

use Pod::Usage;

use Crypt::DES;

my ($password, $ini, $help, $man);

GetOptions('help|h' => \$help, 'man' => \$man, 'password|p=s' => \$password,
           'ini' => \$ini) or pod2usage(2);
pod2usage(1) if $help;
pod2usage(-exitstatus => 0, -verbose =>2) if $man;

pod2usage (1) if !$password;

my $realkey = pack ('H16', "E84AD660C4721AE0");

my $cipher = Crypt::DES->new($realkey);

my $cryptpass = $cipher->encrypt($password);

# If ini file join with '', reg use ','
$ini = $ini ? '' : ',';
print uc join($ini, map {unpack('H2', $_)} split //, $cryptpass), "\n";



Generate a VNC hex for registry

=head1 SYNOPSIS [options]

	--help	   this help
	--password the password you want to crypt
        --ini      use ini style crypted password

=head1 OPTIONS

=over 8

=item B<--help>

Print this help

=item B<--password>

Password to encrypt.

=item B<--ini>

Specify to use new ini style format.
The registry format use ',' separator.



B<> generate a VNC hex registry entry password and print it
to its standard output.