UpdateOperaGX.ps1
<#PSScriptInfo .VERSION 0.0.6 .GUID 0a4998c5-dd45-4bdc-8d16-22c30a1b6e74 .AUTHOR Fabrice Sanga .COMPANYNAME sangafabrice .COPYRIGHT © 2022 SangaFabrice. All rights reserved. .TAGS opera opera-gx chromium update browser .LICENSEURI https://github.com/sangafabrice/reg-cli/blob/main/LICENSE.md .PROJECTURI https://github.com/sangafabrice/reg-cli/tree/operagx .ICONURI https://rawcdn.githack.com/sangafabrice/reg-cli/c1b35f3073b019f8f3363e8526c1595ba0b26a8d/icon.png .EXTERNALMODULEDEPENDENCIES DownloadInfo,RegCli .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES Remove Select-NonEmptyObject from script. .PRIVATEDATA #> #Requires -Module @{ModuleName = 'DownloadInfo'; ModuleVersion = '5.0.4'} #Requires -Module @{ModuleName = 'RegCli'; ModuleVersion = '6.2.2'} [CmdletBinding()] Param ( [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallLocation $_ $PSScriptRoot })] [string] $InstallLocation = "${Env:ProgramData}\OperaGX", [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallerLocation $_ })] [string] $SaveTo = $PSScriptRoot ) & { $NameLocation = "$InstallLocation\launcher.exe" Try { $UpdateModule = Import-CommonScript chrome-installer | Import-Module -PassThru -Force -Verbose:$False @{ UpdateInfo = $( Write-Verbose 'Retrieve install or update information...' Try { Get-DownloadInfo -PropertyList @{ RepositoryID = 'opera_gx' OSArch = Get-ExecutableType $NameLocation FormatedName = 'Opera_GX' } -From Opera } Catch { } ) NameLocation = $NameLocation SaveTo = $SaveTo SoftwareName = 'Opera GX' InstallerDescription = 'Opera GX Installer' Verbose = $VerbosePreference -ine 'SilentlyContinue' } | ForEach-Object { Invoke-CommonScript @_ } } Catch { } Finally { $UpdateModule | Remove-Module -Verbose:$False } } <# .SYNOPSIS Updates Opera GX browser software. .DESCRIPTION The script installs or updates Opera GX browser 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%\OperaGX. .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\OperaGX -ErrorAction SilentlyContinue PS > .\UpdateOperaGX.ps1 -InstallLocation C:\ProgramData\OperaGX -SaveTo . PS > Get-ChildItem C:\ProgramData\OperaGX | Select-Object Name -First 5 Name ---- Assets localization MEIPreload resources 90.0.4480.86.manifest PS > Get-ChildItem | Select-Object Name Name ---- opera_gx_90.0.4480.86.exe UpdateOperaGX.ps1 Install Opera GX browser to 'C:\ProgramData\OperaGX' and save its setup installer to the current directory. #> |