TerminalService.ps1
$ScriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent . ($ScriptDir + "./Global.ps1") $ProductName = "logeto-terminal-service" $ServicePackageName = "Logeto.UWP.Service" <# Return Json file for Terminal Service, if there is no newer version null is returned. #> function Get-LogetoTerminalServiceUpdateInfo { $scope = Get-LogetoScope $serviceVersion = Get-LogetoExeVersion (Get-LogetoServicePath $ServicePackageName) return Get-LogetoUpdateInfo -Product $ProductName -Scope $scope -Version $serviceVersion } <# Install logeto-terminal-service product #> function Install-LogetoTerminalService { Param( [parameter(Mandatory=$true)] $UpdateInfo, [parameter(Mandatory=$false)] $ProductName = 'logeto-terminal-service' ) Get-LogetoProduct $UpdateInfo $ProductName InstallService $LogetoFolder + $DownloadFolderPath + $ProductName } <# Install logeto-terminal product #> function Uninstall-LogetoTerminal { Param( [parameter(Mandatory=$false)] $ProductName = 'logeto-terminal' ) Uninstall $LogetoFolder + $DownloadFolderPath + $ProductName } <# Return Json file from the URL for set product and scope. If version parameter is set it returns Json file only if higher version was found, otherwise returns null. #> function Set-LogetoTerminalServicePrepareEnvironment { Param( [parameter(Mandatory=$false)] $ProductName = 'logeto-terminal' ) $keyname = "AllowAllTrustedApps" $regname = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" if (Test-Path $regname) { $regvalue = (Get-ItemProperty -Path $regname).$keyname if ($regvalue -lt 1) { New-ItemProperty -Path $regname -Name $keyname -Value 1 -PropertyType DWORD -Force } } $keyname = "LogetoTerminal" $regname = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $fullpath = $regname + "\" + $keyname if (-Not (Test-Path $fullpath)) { New-Item -Path $regname -Name $keyname } New-ItemProperty -Path $fullpath -Name "DisplayName" -Value "Logeto Terminal" -Force $value = $TerminalFolder + $ProductName + "\Uninstall\LogetoInstaller.exe -uninstallAsCurrentUser" New-ItemProperty -Path $fullpath -Name "UninstallString" -Value $value -Force New-ItemProperty -Path $fullpath -Name "Publisher" -Value "Systemart s.r.o." -Force $value = $TerminalFolder + $ProductName + "\Uninstall\ProductLogo.ico" New-ItemProperty -Path $fullpath -Name "DisplayIcon" -Value $value -Force } |