-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-ultravnc.ps1
executable file
·48 lines (40 loc) · 1.83 KB
/
provision-ultravnc.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$ultraVncHome = 'C:\Program Files\uvnc bvba\UltraVnc'
choco install -y ultravnc
Write-Host 'Copying configuration file...'
Copy-Item -Force C:\vagrant\UltraVNC.ini $ultraVncHome
Write-Host 'Configuring MS Logon ACL...'
# NB this file was generated with:
# &"C:\Program Files\uvnc bvba\UltraVnc\MSLogonACL.exe" /e C:\vagrant\UltraVNC-MSLogonACL.txt
&"$ultraVncHome\MSLogonACL.exe" /i /o C:\vagrant\UltraVNC-MSLogonACL.txt
# NB VNC password authentication is disabled in UltraVNC.ini,
# this is here to show how we could change the passwords.
# NB the user can login using the local Windows users credentials.
# Write-Host 'Configuring VNC and View-Only passwords...'
# # NB each password must be at most 8 bytes.
# # NB each role should have a different password.
# &"$ultraVncHome\setpasswd.exe" vagrant vagrantViewOnly
Write-Host 'Installing the uvnc_service windows service...'
&"$ultraVncHome\winvnc.exe" -install | Out-String -Stream
Write-Host 'Starting the uvnc_service service...'
Start-Service uvnc_service
# open the firewall.
Write-Host 'Creating the firewall rule to allow inbound TCP/IP access to the UltraVNC port 5900 and 5800...'
New-NetFirewallRule `
-Name 'ULTRAVNC-In-TCP' `
-DisplayName 'UltraVNC (TCP-In)' `
-Direction Inbound `
-Enabled True `
-Protocol TCP `
-LocalPort 5900 `
| Out-Null
# add default desktop shortcuts (called from a provision-common.ps1 generated script).
[IO.File]::WriteAllText(
"$env:USERPROFILE\ConfigureDesktop-UltraVnc.ps1",
@'
Install-ChocolateyShortcut `
-ShortcutFilePath "$env:USERPROFILE\Desktop\UltraVNC Viewer.lnk" `
-TargetPath 'C:\Program Files\uvnc bvba\UltraVnc\vncviewer.exe'
Install-ChocolateyShortcut `
-ShortcutFilePath "$env:USERPROFILE\Desktop\UltraVNC Settings.lnk" `
-TargetPath 'C:\Program Files\uvnc bvba\UltraVnc\uvnc_settings.exe'
'@)