UpdatePrepros.ps1
<#PSScriptInfo .VERSION 0.0.4 .GUID db0bfe17-68c0-4fc5-9fc4-8333cf4c7ed3 .AUTHOR Fabrice Sanga .COMPANYNAME sangafabrice .COPYRIGHT © 2022 SangaFabrice. All rights reserved. .TAGS prepros nuget-package update ide .LICENSEURI https://github.com/sangafabrice/reg-cli/blob/main/LICENSE.md .PROJECTURI https://github.com/sangafabrice/reg-cli/tree/prepros .ICONURI https://rawcdn.githack.com/sangafabrice/reg-cli/81991b3ae3db9d9ad5cecc31fe33fd33c2ff5ce7/icon.png .EXTERNALMODULEDEPENDENCIES DownloadInfo,RegCli .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES Initialize Prepros updater script. .PRIVATEDATA #> #Requires -Module @{ModuleVersion = '5.0.4'; ModuleName = 'DownloadInfo'} #Requires -Module @{ModuleVersion = '6.2.2'; ModuleName = 'RegCli'} [CmdletBinding()] Param ( [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallLocation $_ $PSScriptRoot })] [string] $InstallLocation = "${Env:ProgramData}\Prepros", [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 Prepros } Catch { } ) NameLocation = "$InstallLocation\Prepros.exe" SaveTo = $SaveTo SoftwareName = 'Prepros' InstallerType = 'Squirrel' Verbose = $VerbosePreference -ine 'SilentlyContinue' } | ForEach-Object { Invoke-CommonScript @_ } } Catch { } Finally { $UpdateModule | Remove-Module -Verbose:$False } } <# .SYNOPSIS Updates Prepros software. .DESCRIPTION The script installs or updates Prepros 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%\Prepros". .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\Prepros' -ErrorAction SilentlyContinue PS > .\UpdatePrepros.ps1 -InstallLocation 'C:\ProgramData\Prepros' -SaveTo . PS > Get-ChildItem 'C:\ProgramData\Prepros' | Select-Object Name -First 5 Name ---- locales resources swiftshader chrome_100_percent.pak chrome_200_percent.pak PS > Get-ChildItem | Select-Object Name Name ---- prepros_7.6.0.exe UpdatePrepros.ps1 Install Prepros to 'C:\ProgramData\Prepros' and save its setup installer to the current directory. #> |