2
0

install-jellyfin.ps1 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. [CmdletBinding()]
  2. param(
  3. [Switch]$Quiet,
  4. [Switch]$InstallAsService,
  5. [pscredential]$ServiceUser,
  6. [switch]$CreateDesktopShorcut,
  7. [switch]$LaunchJellyfin,
  8. [switch]$MigrateEmbyLibrary,
  9. [string]$InstallLocation,
  10. [string]$EmbyLibraryLocation,
  11. [string]$JellyfinLibraryLocation
  12. )
  13. <# This form was created using POSHGUI.com a free online gui designer for PowerShell
  14. .NAME
  15. Install-Jellyfin
  16. #>
  17. #This doesn't need to be used by default anymore, but I am keeping it in as a function for future use.
  18. function Elevate-Window {
  19. # Get the ID and security principal of the current user account
  20. $myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
  21. $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
  22. # Get the security principal for the Administrator role
  23. $adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
  24. # Check to see if we are currently running "as Administrator"
  25. if ($myWindowsPrincipal.IsInRole($adminRole))
  26. {
  27. # We are running "as Administrator" - so change the title and background color to indicate this
  28. $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
  29. $Host.UI.RawUI.BackgroundColor = "DarkBlue"
  30. clear-host
  31. }
  32. else
  33. {
  34. # We are not running "as Administrator" - so relaunch as administrator
  35. # Create a new process object that starts PowerShell
  36. $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
  37. # Specify the current script path and name as a parameter
  38. $newProcess.Arguments = $myInvocation.MyCommand.Definition;
  39. # Indicate that the process should be elevated
  40. $newProcess.Verb = "runas";
  41. # Start the new process
  42. [System.Diagnostics.Process]::Start($newProcess);
  43. # Exit from the current, unelevated, process
  44. exit
  45. }
  46. }
  47. #FIXME The install methods should be a function that takes all the params, the quiet flag should be a paramset
  48. if($Quiet.IsPresent -or $Quiet -eq $true){
  49. if([string]::IsNullOrEmpty($JellyfinLibraryLocation)){
  50. $Script:JellyfinDataDir = "$env:AppData\jellyfin\"
  51. }else{
  52. $Script:JellyfinDataDir = $JellyfinLibraryLocation
  53. }
  54. if([string]::IsNullOrEmpty($InstallLocation)){
  55. $Script:DefaultJellyfinInstallDirectory = "$env:Appdata\jellyfin\"
  56. }else{
  57. $Script:DefaultJellyfinInstallDirectory = $InstallLocation
  58. }
  59. if([string]::IsNullOrEmpty($EmbyLibraryLocation)){
  60. $Script:defaultEmbyDataDir = "$env:Appdata\Emby-Server\data\"
  61. }else{
  62. $Script:defaultEmbyDataDir = $EmbyLibraryLocation
  63. }
  64. if($InstallAsService.IsPresent -or $InstallAsService -eq $true){
  65. $Script:InstallAsService = $true
  66. }else{$Script:InstallAsService = $false}
  67. if($null -eq $ServiceUser){
  68. $Script:InstallServiceAsUser = $false
  69. }else{
  70. $Script:InstallServiceAsUser = $true
  71. $Script:UserCredentials = $ServiceUser
  72. $Script:JellyfinDataDir = "C:\Users\$($Script:UserCredentials.UserName)\Appdata\Roaming\jellyfin\"}
  73. if($CreateDesktopShorcut.IsPresent -or $CreateDesktopShorcut -eq $true) {$Script:CreateShortcut = $true}else{$Script:CreateShortcut = $false}
  74. if($MigrateEmbyLibrary.IsPresent -or $MigrateEmbyLibrary -eq $true){$Script:MigrateLibrary = $true}else{$Script:MigrateLibrary = $false}
  75. if($LaunchJellyfin.IsPresent -or $LaunchJellyfin -eq $true){$Script:StartJellyfin = $true}else{$Script:StartJellyfin = $false}
  76. if(-not (Test-Path $Script:DefaultJellyfinInstallDirectory)){
  77. mkdir $Script:DefaultJellyfinInstallDirectory
  78. }
  79. Copy-Item -Path $PSScriptRoot/* -DestinationPath "$Script:DefaultJellyfinInstallDirectory/" -Force -Recurse
  80. if($Script:InstallAsService){
  81. if($Script:InstallServiceAsUser){
  82. &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
  83. Start-Sleep -Milliseconds 500
  84. &sc.exe config Jellyfin obj=".\$($Script:UserCredentials.UserName)" password="$($Script:UserCredentials.GetNetworkCredential().Password)"
  85. &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
  86. }else{
  87. &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
  88. Start-Sleep -Milliseconds 500
  89. #&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin ObjectName $Script:UserCredentials.UserName $Script:UserCredentials.GetNetworkCredential().Password
  90. #Set-Service -Name Jellyfin -Credential $Script:UserCredentials
  91. &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
  92. }
  93. }
  94. if($Script:MigrateLibrary){
  95. Copy-Item -Path $Script:defaultEmbyDataDir/config -Destination $Script:JellyfinDataDir -force -Recurse
  96. Copy-Item -Path $Script:defaultEmbyDataDir/cache -Destination $Script:JellyfinDataDir -force -Recurse
  97. Copy-Item -Path $Script:defaultEmbyDataDir/data -Destination $Script:JellyfinDataDir -force -Recurse
  98. Copy-Item -Path $Script:defaultEmbyDataDir/metadata -Destination $Script:JellyfinDataDir -force -Recurse
  99. Copy-Item -Path $Script:defaultEmbyDataDir/root -Destination $Script:JellyfinDataDir -force -Recurse
  100. }
  101. if($Script:CreateShortcut){
  102. $WshShell = New-Object -comObject WScript.Shell
  103. $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Jellyfin.lnk")
  104. $Shortcut.TargetPath = "$Script:DefaultJellyfinInstallDirectory\jellyfin.exe"
  105. $Shortcut.Save()
  106. }
  107. if($Script:StartJellyfin){
  108. if($Script:InstallAsService){
  109. Get-Service Jellyfin | Start-Service
  110. }else{
  111. Start-Process -FilePath $Script:DefaultJellyfinInstallDirectory\jellyfin.exe -PassThru
  112. }
  113. }
  114. }else{
  115. }
  116. Add-Type -AssemblyName System.Windows.Forms
  117. [System.Windows.Forms.Application]::EnableVisualStyles()
  118. $Script:JellyFinDataDir = "$env:AppData\jellyfin\"
  119. $Script:DefaultJellyfinInstallDirectory = "$env:Appdata\jellyfin\"
  120. $Script:defaultEmbyDataDir = "$env:Appdata\Emby-Server\"
  121. $Script:InstallAsService = $False
  122. $Script:InstallServiceAsUser = $false
  123. $Script:CreateShortcut = $false
  124. $Script:MigrateLibrary = $false
  125. $Script:StartJellyfin = $false
  126. function InstallJellyfin {
  127. Write-Host "Install as service: $Script:InstallAsService"
  128. Write-Host "Install as serviceuser: $Script:InstallServiceAsUser"
  129. Write-Host "Create Shortcut: $Script:CreateShortcut"
  130. Write-Host "MigrateLibrary: $Script:MigrateLibrary"
  131. $GUIElementsCollection | ForEach-Object {
  132. $_.Enabled = $false
  133. }
  134. Write-Host "Making Jellyfin directory"
  135. $ProgressBar.Minimum = 1
  136. $ProgressBar.Maximum = 100
  137. $ProgressBar.Value = 1
  138. if($Script:DefaultJellyfinInstallDirectory -ne $InstallLocationBox.Text){
  139. Write-Host "Custom Install Location Chosen: $($InstallLocationBox.Text)"
  140. $Script:DefaultJellyfinInstallDirectory = $InstallLocationBox.Text
  141. }
  142. if($Script:JellyfinDataDir -ne $CustomLibraryBox.Text){
  143. Write-Host "Custom Library Location Chosen: $($CustomLibraryBox.Text)"
  144. $Script:JellyfinDataDir = $CustomLibraryBox.Text
  145. }
  146. if(-not (Test-Path $Script:DefaultJellyfinInstallDirectory)){
  147. mkdir $Script:DefaultJellyfinInstallDirectory
  148. }
  149. Write-Host "Copying Jellyfin Data"
  150. $progressbar.Value = 10
  151. Copy-Item -Path $PSScriptRoot/* -Destination $Script:DefaultJellyfinInstallDirectory/ -Force -Recurse
  152. Write-Host "Finished Copying"
  153. $ProgressBar.Value = 50
  154. if($Script:InstallAsService){
  155. if($Script:InstallServiceAsUser){
  156. Write-Host "Installing Service as user $($Script:UserCredentials.UserName)"
  157. &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
  158. Start-Sleep -Milliseconds 2000
  159. &sc.exe config Jellyfin obj=".\$($Script:UserCredentials.UserName)" password="$($Script:UserCredentials.GetNetworkCredential().Password)"
  160. &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
  161. }else{
  162. Write-Host "Installing Service as LocalSystem"
  163. &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
  164. Start-Sleep -Milliseconds 2000
  165. &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
  166. }
  167. }
  168. $progressbar.Value = 60
  169. if($Script:MigrateLibrary){
  170. if($Script:defaultEmbyDataDir -ne $LibraryLocationBox.Text){
  171. Write-Host "Custom location defined for emby library: $($LibraryLocationBox.Text)"
  172. $Script:defaultEmbyDataDir = $LibraryLocationBox.Text
  173. }
  174. Write-Host "Copying emby library from $Script:defaultEmbyDataDir to $Script:JellyFinDataDir"
  175. Write-Host "This could take a while depending on the size of your library. Please be patient"
  176. Write-Host "Copying config"
  177. Copy-Item -Path $Script:defaultEmbyDataDir/config -Destination $Script:JellyfinDataDir -force -Recurse
  178. Write-Host "Copying cache"
  179. Copy-Item -Path $Script:defaultEmbyDataDir/cache -Destination $Script:JellyfinDataDir -force -Recurse
  180. Write-Host "Copying data"
  181. Copy-Item -Path $Script:defaultEmbyDataDir/data -Destination $Script:JellyfinDataDir -force -Recurse
  182. Write-Host "Copying metadata"
  183. Copy-Item -Path $Script:defaultEmbyDataDir/metadata -Destination $Script:JellyfinDataDir -force -Recurse
  184. Write-Host "Copying root dir"
  185. Copy-Item -Path $Script:defaultEmbyDataDir/root -Destination $Script:JellyfinDataDir -force -Recurse
  186. }
  187. $progressbar.Value = 80
  188. if($Script:CreateShortcut){
  189. Write-Host "Creating Shortcut"
  190. $WshShell = New-Object -comObject WScript.Shell
  191. $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Jellyfin.lnk")
  192. $Shortcut.TargetPath = "$Script:DefaultJellyfinInstallDirectory\jellyfin.exe"
  193. $Shortcut.Save()
  194. }
  195. $ProgressBar.Value = 90
  196. if($Script:StartJellyfin){
  197. if($Script:InstallAsService){
  198. Write-Host "Starting Jellyfin Service"
  199. Get-Service Jellyfin | Start-Service
  200. }else{
  201. Write-Host "Starting Jellyfin"
  202. Start-Process -FilePath $Script:DefaultJellyfinInstallDirectory\jellyfin.exe -PassThru
  203. }
  204. }
  205. $progressbar.Value = 100
  206. Write-Host Finished
  207. $wshell = New-Object -ComObject Wscript.Shell
  208. $wshell.Popup("Operation Completed",0,"Done",0x1)
  209. $InstallForm.Close()
  210. }
  211. function ServiceBoxCheckChanged {
  212. if($InstallAsServiceCheck.Checked){
  213. $Script:InstallAsService = $true
  214. $ServiceUserLabel.Visible = $true
  215. $ServiceUserLabel.Enabled = $true
  216. $ServiceUserBox.Visible = $true
  217. $ServiceUserBox.Enabled = $true
  218. }else{
  219. $Script:InstallAsService = $false
  220. $ServiceUserLabel.Visible = $false
  221. $ServiceUserLabel.Enabled = $false
  222. $ServiceUserBox.Visible = $false
  223. $ServiceUserBox.Enabled = $false
  224. }
  225. }
  226. function UserSelect {
  227. if($ServiceUserBox.Text -eq 'Local System')
  228. {
  229. $Script:InstallServiceAsUser = $false
  230. $Script:UserCredentials = $null
  231. $ServiceUserBox.Items.RemoveAt(1)
  232. $ServiceUserBox.Items.Add("Custom User")
  233. }elseif($ServiceUserBox.Text -eq 'Custom User'){
  234. $Script:InstallServiceAsUser = $true
  235. $Script:UserCredentials = Get-Credential -Message "Please enter the credentials of the user you with to run Jellyfin Service as" -UserName $env:USERNAME
  236. $ServiceUserBox.Items[1] = "$($Script:UserCredentials.UserName)"
  237. }
  238. }
  239. function CreateShortcutBoxCheckChanged {
  240. if($CreateShortcutCheck.Checked){
  241. $Script:CreateShortcut = $true
  242. }else{
  243. $Script:CreateShortcut = $False
  244. }
  245. }
  246. function StartJellyFinBoxCheckChanged {
  247. if($StartProgramCheck.Checked){
  248. $Script:StartJellyfin = $true
  249. }else{
  250. $Script:StartJellyfin = $false
  251. }
  252. }
  253. function CustomLibraryCheckChanged {
  254. if($CustomLibraryCheck.Checked){
  255. $Script:UseCustomLibrary = $true
  256. $CustomLibraryBox.Enabled = $true
  257. }else{
  258. $Script:UseCustomLibrary = $false
  259. $CustomLibraryBox.Enabled = $false
  260. }
  261. }
  262. function MigrateLibraryCheckboxChanged {
  263. if($MigrateLibraryCheck.Checked){
  264. $Script:MigrateLibrary = $true
  265. $LibraryMigrationLabel.Visible = $true
  266. $LibraryMigrationLabel.Enabled = $true
  267. $LibraryLocationBox.Visible = $true
  268. $LibraryLocationBox.Enabled = $true
  269. }else{
  270. $Script:MigrateLibrary = $false
  271. $LibraryMigrationLabel.Visible = $false
  272. $LibraryMigrationLabel.Enabled = $false
  273. $LibraryLocationBox.Visible = $false
  274. $LibraryLocationBox.Enabled = $false
  275. }
  276. }
  277. #region begin GUI{
  278. $InstallForm = New-Object system.Windows.Forms.Form
  279. $InstallForm.ClientSize = '320,240'
  280. $InstallForm.text = "Terrible Jellyfin Installer"
  281. $InstallForm.TopMost = $false
  282. $GUIElementsCollection = @()
  283. $InstallButton = New-Object system.Windows.Forms.Button
  284. $InstallButton.text = "Install"
  285. $InstallButton.width = 60
  286. $InstallButton.height = 30
  287. $InstallButton.location = New-Object System.Drawing.Point(5,5)
  288. $InstallButton.Font = 'Microsoft Sans Serif,10'
  289. $GUIElementsCollection += $InstallButton
  290. $ProgressBar = New-Object system.Windows.Forms.ProgressBar
  291. $ProgressBar.width = 245
  292. $ProgressBar.height = 30
  293. $ProgressBar.location = New-Object System.Drawing.Point(70,5)
  294. $InstallLocationLabel = New-Object system.Windows.Forms.Label
  295. $InstallLocationLabel.text = "Install Location"
  296. $InstallLocationLabel.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
  297. $InstallLocationLabel.AutoSize = $true
  298. $InstallLocationLabel.width = 100
  299. $InstallLocationLabel.height = 20
  300. $InstallLocationLabel.location = New-Object System.Drawing.Point(5,50)
  301. $InstallLocationLabel.Font = 'Microsoft Sans Serif,10'
  302. $GUIElementsCollection += $InstallLocationLabel
  303. $InstallLocationBox = New-Object system.Windows.Forms.TextBox
  304. $InstallLocationBox.multiline = $false
  305. $InstallLocationBox.width = 205
  306. $InstallLocationBox.height = 20
  307. $InstallLocationBox.location = New-Object System.Drawing.Point(110,50)
  308. $InstallLocationBox.Text = $Script:DefaultJellyfinInstallDirectory
  309. $InstallLocationBox.Font = 'Microsoft Sans Serif,10'
  310. $GUIElementsCollection += $InstallLocationBox
  311. $CustomLibraryCheck = New-Object system.Windows.Forms.CheckBox
  312. $CustomLibraryCheck.text = "Custom Library Location:"
  313. $CustomLibraryCheck.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
  314. $CustomLibraryCheck.AutoSize = $false
  315. $CustomLibraryCheck.width = 180
  316. $CustomLibraryCheck.height = 20
  317. $CustomLibraryCheck.location = New-Object System.Drawing.Point(5,75)
  318. $CustomLibraryCheck.Font = 'Microsoft Sans Serif,10'
  319. $GUIElementsCollection += $CustomLibraryCheck
  320. $CustomLibraryBox = New-Object system.Windows.Forms.TextBox
  321. $CustomLibraryBox.multiline = $false
  322. $CustomLibraryBox.width = 130
  323. $CustomLibraryBox.height = 20
  324. $CustomLibraryBox.location = New-Object System.Drawing.Point(185,75)
  325. $CustomLibraryBox.Text = $Script:JellyFinDataDir
  326. $CustomLibraryBox.Font = 'Microsoft Sans Serif,10'
  327. $CustomLibraryBox.Enabled = $false
  328. $GUIElementsCollection += $CustomLibraryBox
  329. $InstallAsServiceCheck = New-Object system.Windows.Forms.CheckBox
  330. $InstallAsServiceCheck.text = "Install as Service"
  331. $InstallAsServiceCheck.AutoSize = $false
  332. $InstallAsServiceCheck.width = 140
  333. $InstallAsServiceCheck.height = 20
  334. $InstallAsServiceCheck.location = New-Object System.Drawing.Point(5,125)
  335. $InstallAsServiceCheck.Font = 'Microsoft Sans Serif,10'
  336. $GUIElementsCollection += $InstallAsServiceCheck
  337. $ServiceUserLabel = New-Object system.Windows.Forms.Label
  338. $ServiceUserLabel.text = "Run Service As:"
  339. $ServiceUserLabel.AutoSize = $true
  340. $ServiceUserLabel.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
  341. $ServiceUserLabel.width = 100
  342. $ServiceUserLabel.height = 20
  343. $ServiceUserLabel.location = New-Object System.Drawing.Point(15,145)
  344. $ServiceUserLabel.Font = 'Microsoft Sans Serif,10'
  345. $ServiceUserLabel.Visible = $false
  346. $ServiceUserLabel.Enabled = $false
  347. $GUIElementsCollection += $ServiceUserLabel
  348. $ServiceUserBox = New-Object system.Windows.Forms.ComboBox
  349. $ServiceUserBox.text = "Run Service As"
  350. $ServiceUserBox.width = 195
  351. $ServiceUserBox.height = 20
  352. @('Local System','Custom User') | ForEach-Object {[void] $ServiceUserBox.Items.Add($_)}
  353. $ServiceUserBox.location = New-Object System.Drawing.Point(120,145)
  354. $ServiceUserBox.Font = 'Microsoft Sans Serif,10'
  355. $ServiceUserBox.Visible = $false
  356. $ServiceUserBox.Enabled = $false
  357. $ServiceUserBox.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropDownList
  358. $GUIElementsCollection += $ServiceUserBox
  359. $MigrateLibraryCheck = New-Object system.Windows.Forms.CheckBox
  360. $MigrateLibraryCheck.text = "Import Emby Library"
  361. $MigrateLibraryCheck.AutoSize = $false
  362. $MigrateLibraryCheck.width = 160
  363. $MigrateLibraryCheck.height = 20
  364. $MigrateLibraryCheck.location = New-Object System.Drawing.Point(5,170)
  365. $MigrateLibraryCheck.Font = 'Microsoft Sans Serif,10'
  366. $GUIElementsCollection += $MigrateLibraryCheck
  367. $LibraryMigrationLabel = New-Object system.Windows.Forms.Label
  368. $LibraryMigrationLabel.text = "Emby Library Path"
  369. $LibraryMigrationLabel.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
  370. $LibraryMigrationLabel.AutoSize = $false
  371. $LibraryMigrationLabel.width = 120
  372. $LibraryMigrationLabel.height = 20
  373. $LibraryMigrationLabel.location = New-Object System.Drawing.Point(15,190)
  374. $LibraryMigrationLabel.Font = 'Microsoft Sans Serif,10'
  375. $LibraryMigrationLabel.Visible = $false
  376. $LibraryMigrationLabel.Enabled = $false
  377. $GUIElementsCollection += $LibraryMigrationLabel
  378. $LibraryLocationBox = New-Object system.Windows.Forms.TextBox
  379. $LibraryLocationBox.multiline = $false
  380. $LibraryLocationBox.width = 175
  381. $LibraryLocationBox.height = 20
  382. $LibraryLocationBox.location = New-Object System.Drawing.Point(140,190)
  383. $LibraryLocationBox.Text = $Script:defaultEmbyDataDir
  384. $LibraryLocationBox.Font = 'Microsoft Sans Serif,10'
  385. $LibraryLocationBox.Visible = $false
  386. $LibraryLocationBox.Enabled = $false
  387. $GUIElementsCollection += $LibraryLocationBox
  388. $CreateShortcutCheck = New-Object system.Windows.Forms.CheckBox
  389. $CreateShortcutCheck.text = "Desktop Shortcut"
  390. $CreateShortcutCheck.AutoSize = $false
  391. $CreateShortcutCheck.width = 150
  392. $CreateShortcutCheck.height = 20
  393. $CreateShortcutCheck.location = New-Object System.Drawing.Point(5,215)
  394. $CreateShortcutCheck.Font = 'Microsoft Sans Serif,10'
  395. $GUIElementsCollection += $CreateShortcutCheck
  396. $StartProgramCheck = New-Object system.Windows.Forms.CheckBox
  397. $StartProgramCheck.text = "Start Jellyfin"
  398. $StartProgramCheck.AutoSize = $false
  399. $StartProgramCheck.width = 160
  400. $StartProgramCheck.height = 20
  401. $StartProgramCheck.location = New-Object System.Drawing.Point(160,215)
  402. $StartProgramCheck.Font = 'Microsoft Sans Serif,10'
  403. $GUIElementsCollection += $StartProgramCheck
  404. $InstallForm.controls.AddRange($GUIElementsCollection)
  405. $InstallForm.Controls.Add($ProgressBar)
  406. #region gui events {
  407. $InstallButton.Add_Click({ InstallJellyfin })
  408. $CustomLibraryCheck.Add_CheckedChanged({CustomLibraryCheckChanged})
  409. $InstallAsServiceCheck.Add_CheckedChanged({ServiceBoxCheckChanged})
  410. $ServiceUserBox.Add_SelectedValueChanged({ UserSelect })
  411. $MigrateLibraryCheck.Add_CheckedChanged({MigrateLibraryCheckboxChanged})
  412. $CreateShortcutCheck.Add_CheckedChanged({CreateShortcutBoxCheckChanged})
  413. $StartProgramCheck.Add_CheckedChanged({StartJellyFinBoxCheckChanged})
  414. #endregion events }
  415. #endregion GUI }
  416. [void]$InstallForm.ShowDialog()