forked from tomarbuthnot/Run-PowerShell-Directly-From-GitHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlauncher.ps1
111 lines (97 loc) · 5.26 KB
/
launcher.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
[reflection.assembly]::LoadWithPartialName("System.Drawing") | Out-Null
[reflection.assembly]::LoadWithPartialName("System.Windows.forms") | Out-Null
[System.Windows.forms.Application]::EnableVisualStyles()
$Version = '21.07.5'
$Workdir = 'C:\DST\WFH\'
$Imagedir = "$Workdir\Images\"
$Installer = "$Workdir\pcoip-client_$Version.exe"
$Clientbin = 'C:\DST\WFH\Client\bin\pcoip_client.exe'
$Opts = '--disable-usb --use-single-logfile --quit-after-disconnect --force-native-resolution -b pcoip.distilleryvfx.com'
Write-Host " "
Write-Host "Bootstrapping..."
Write-Host " "
if ( -not ( Test-Path -Path "$Workdir" ) )
{
New-Item -ItemType Directory -Force -Path "$Workdir" | Out-Null
}
#if ( -not ( Test-Path -Path "$Imagedir" ) )
#{
New-Item -ItemType Directory -Force -Path "$Imagedir" | Out-Null
Invoke-WebRequest -Uri https://raw.githubusercontent.com/anthonymoon/wfh/master/Images/DST_LOGO.png -OutFile $Imagedir/DST_LOGO.png
Invoke-WebRequest -Uri https://raw.githubusercontent.com/anthonymoon/wfh/master/Images/distilleryvfx.ico -OutFile $Imagedir/distilleryvfx.ico
Invoke-WebRequest -Uri https://raw.githubusercontent.com/anthonymoon/wfh/master/Images/customlogo.png -OutFile C:\ProgramData\Teradici\PCoIPClient\customlogo.png
#}
if ( -not ( Test-Path -Path "$Installer" ) )
{
Invoke-WebRequest -Uri https://dl.teradici.com/JpftnIRNhRANkfjd/pcoip-client/raw/names/pcoip-client-exe/versions/$Version/pcoip-client_$Version.exe -OutFile $Installer
}
if ( -not ( Test-Path -Path "$Clientbin" ) )
{
Start-Process -FilePath "$Installer" -ArgumentList "/S /force /D=C:\DST\WFH\Client\" -Verb RunAs -Wait | Out-Null
}
if ( -not ( Get-NetFirewallRule -DisplayName "*PCoIP*" ) )
{
New-NetFirewallRule -DisplayName "Allow PCoIP Client Outbound" -Direction Outbound -Program "$Clientbin" -RemoteAddress Any -Action Allow | Out-Null
New-NetFirewallRule -DisplayName "Allow PCoIP Client Inbound" -Direction Inbound -Program "$Clientbin" -RemoteAddress Any -Action Allow | Out-Null
}
Write-Host " "
Write-Host "Starting..."
Write-Host " "
function Button_OnClick() {
"`$combo.SelectedItem = $($combo.SelectedItem)"
## Set menu arguments here
if ($combo.SelectedItem -eq 'Window Mode') {
Start-Process -FilePath "$Clientbin" -ArgumentList '--disable-usb --use-single-logfile --quit-after-disconnect -b pcoip.distilleryvfx.com'
} elseif ($combo.SelectedItem -eq 'Window Mode - Wacom Pressure Sensitivity') {
Start-Process -FilePath "$Clientbin" -ArgumentList '--use-single-logfile --quit-after-disconnect -b pcoip.distilleryvfx.com --vidpid-auto-forward "056a,0357"'
}
elseif ($combo.SelectedItem -eq 'Full Screen') {
Start-Process -FilePath "$Clientbin" -ArgumentList '--disable-usb --use-single-logfile --quit-after-disconnect -b pcoip.distilleryvfx.com -f'
}
elseif ($combo.SelectedItem -eq 'Full Screen - Wacom Pressure Sensitivity') {
Start-Process -FilePath "$Clientbin" -ArgumentList '--use-single-logfile --quit-after-disconnect -b pcoip.distilleryvfx.com -f --vidpid-auto-forward "056a,0357"'
}
}
$combo = New-Object system.Windows.forms.ComboBox
$combo.Location = New-Object System.Drawing.Point(12,153)
$combo.Font = New-Object System.Drawing.Font("Calibri",11)
$combo.Width = 450
$combo.Height = 47
## Add new menu items here
$combo.Items.Add('Window Mode') | Out-Null
$combo.Items.Add('Window Mode - Wacom Pressure Sensitivity') | Out-Null
$combo.Items.Add('Full Screen') | Out-Null
$combo.Items.Add('Full Screen - Wacom Pressure Sensitivity') | Out-Null
$combo.SelectedIndex = 0
$button = New-Object -TypeName System.Windows.forms.Button
$button.location = New-Object System.Drawing.Point(470,149)
$button.Font = New-Object System.Drawing.Font("Calibri",11,[System.drawing.FontStyle]::Bold)
$button.Text = 'Launch PCoIP Client'
$button.width = 149
$button.height = 30
$pictureBox = New-Object system.Windows.forms.PictureBox
$pictureBox.Location = New-Object System.Drawing.Point(22,19)
$pictureBox.Width = 600
$pictureBox.Height = 100
$pictureBox.ImageLocation = "$Imagedir/DST_LOGO.png"
$pictureBox.BackColor = "Black"
$pictureBox.SizeMode = [System.Windows.forms.PictureBoxSizeMode]::Zoom
$label = New-Object System.Windows.Forms.Label
$label.Location = New-Object System.Drawing.Point(12,135)
$label.Size = New-Object System.Drawing.Size(280,20)
$label.Font = New-Object System.Drawing.Font("Calibri",11)
$label.Text = 'Please Select Session Options:'
$button.Add_Click({ Button_OnClick ; $form.Close()})
$form = New-Object system.Windows.forms.form
$form.ClientSize = New-Object System.Drawing.Point(640,190)
$form.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon("$Imagedir\distilleryvfx.ico")
$form.Text = "Distillery VFX WFH Launcher"
$form.formBorderStyle = 'Fixed3D'
$form.MaximizeBox = $false
$form.TopMost = $true
$form.StartPosition = [System.Windows.forms.formStartPosition]::CenterScreen
$form.Controls.Add($combo)
$form.Controls.Add($button)
$form.Controls.Add($pictureBox)
$form.Controls.Add($label)
$form.ShowDialog() | Out-Null