UpdateOpera.ps1
<#PSScriptInfo .VERSION 2.0.6 .GUID 18f65546-088c-4ef1-bc92-513cbb3bfcf9 .AUTHOR Fabrice Sanga .COMPANYNAME sangafabrice .COPYRIGHT © 2022 SangaFabrice. All rights reserved. .TAGS opera chromium update browser .LICENSEURI https://github.com/sangafabrice/reg-cli/blob/main/LICENSE.md .PROJECTURI https://github.com/sangafabrice/reg-cli/tree/opera .ICONURI https://rawcdn.githack.com/sangafabrice/reg-cli/642e5e98a5620f1841db0694588e3417f9c89535/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}\Opera", [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/desktop' OSArch = Get-ExecutableType $NameLocation FormatedName = 'Opera' } -From Opera } Catch { } ) NameLocation = $NameLocation SaveTo = $SaveTo SoftwareName = 'Opera' InstallerDescription = 'Opera Installer' Verbose = $VerbosePreference -ine 'SilentlyContinue' } | ForEach-Object { Invoke-CommonScript @_ } } Catch { } Finally { $UpdateModule | Remove-Module -Verbose:$False } } <# .SYNOPSIS Updates Opera browser software. .DESCRIPTION The script installs or updates Opera 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%\Opera. .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\Opera -ErrorAction SilentlyContinue PS > .\UpdateOpera.ps1 -InstallLocation C:\ProgramData\Opera -SaveTo . PS > Get-ChildItem C:\ProgramData\Opera | Select-Object Name -First 5 Name ---- Assets localization MEIPreload resources 90.0.4480.84.manifest PS > Get-ChildItem | Select-Object Name Name ---- opera_90.0.4480.84.exe UpdateOpera.ps1 Install Opera browser to 'C:\ProgramData\Opera' and save its setup installer to the current directory. #> |