UpdateTermius.ps1
<#PSScriptInfo .VERSION 0.0.1 .GUID 6366d99c-37c4-45a7-adb8-5df73b93ae91 .AUTHOR Fabrice Sanga .COMPANYNAME sangafabrice .COPYRIGHT © 2022 SangaFabrice. All rights reserved. .TAGS termius nuget-package update ssh .LICENSEURI https://github.com/sangafabrice/reg-cli/blob/main/LICENSE.md .PROJECTURI https://github.com/sangafabrice/reg-cli/tree/termius .ICONURI https://rawcdn.githack.com/sangafabrice/reg-cli/0aad4dd995f076881747b03518cf1bc67ffbf0c8/icon.png .EXTERNALMODULEDEPENDENCIES DownloadInfo,RegCli .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES Initialize Termius updater script. .PRIVATEDATA #> #Requires -Module @{ModuleName = 'DownloadInfo'; ModuleVersion = '5.0.4'} #Requires -Module @{ModuleName = 'RegCli'; ModuleVersion = '6.2.3'} [CmdletBinding()] Param ( [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallLocation $_ $PSScriptRoot })] [string] $InstallLocation = "${Env:ProgramData}\Termius", [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallerLocation $_ })] [string] $SaveTo = $PSScriptRoot ) & { Try { $UpdateModule = Import-CommonScript chrome-installer | Import-Module -PassThru -Force -Verbose:$False @{ UpdateInfo = $( Write-Verbose 'Retrieve install or update information...' Try { Get-DownloadInfo -From Termius } Catch { } ) NameLocation = "$InstallLocation\Termius.exe" SaveTo = $SaveTo SoftwareName = 'Termius' InstallerDescription = 'Desktop SSH Client' InstallerType = 'NSIS' CompareInstalls = $True Verbose = $VerbosePreference -ine 'SilentlyContinue' } | ForEach-Object { Invoke-CommonScript @_ } } Catch { } Finally { $UpdateModule | Remove-Module -Verbose:$False } } <# .SYNOPSIS Updates Termius software. .DESCRIPTION The script installs or updates Termius on Windows. .NOTES Required: at least Powershell Core 7. .PARAMETER InstallLocation Path to the installation directory. It is restricted to file system paths. It does not necessary exists. It defaults to "%ProgramData%\Termius". .PARAMETER SaveTo Path to the directory of the downloaded installer. It is an existing file system path. It defaults to the script directory. .EXAMPLE Get-ChildItem 'C:\ProgramData\Termius' -ErrorAction SilentlyContinue PS > .\UpdateTermius.ps1 -InstallLocation 'C:\ProgramData\Termius' -SaveTo . PS > Get-ChildItem 'C:\ProgramData\Termius' | Select-Object Name -First 5 Name ---- locales resources swiftshader chrome_100_percent.pak chrome_200_percent.pak PS > Get-ChildItem | Select-Object Name Name ---- termius_2022.255.403.3.exe UpdateTermius.ps1 Install Termius to 'C:\ProgramData\Termius' and save its setup installer to the current directory. #> |