UpdateMSEdge.ps1
<#PSScriptInfo .VERSION 2.0.7 .GUID 711fbaea-637f-4424-99e6-0a3c06e62874 .AUTHOR Fabrice Sanga .COMPANYNAME sangafabrice .COPYRIGHT © 2022 SangaFabrice. All rights reserved. .TAGS edge microsoft chromium update browser .LICENSEURI https://github.com/sangafabrice/reg-cli/blob/main/LICENSE.md .PROJECTURI https://github.com/sangafabrice/reg-cli/tree/msedge .ICONURI https://rawcdn.githack.com/sangafabrice/reg-cli/363ae3d7fb7b37a4bd4f523465361d000b8fc831/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}\MSEdge", [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallerLocation $_ })] [string] $SaveTo = $PSScriptRoot ) & { $BaseNameLocation = "$InstallLocation\msedge" $NameLocation = "$BaseNameLocation.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 @{ OSArch = Get-ExecutableType $NameLocation } -From MSEdge } Catch { } ) NameLocation = $NameLocation SaveTo = $SaveTo SoftwareName = 'Microsoft Edge' InstallerDescription = 'Microsoft Edge Installer' VisualElementManifest = @{ BaseNameLocation = $BaseNameLocation HexColor = '#173A73' } SkipSslValidation = $True Verbose = $VerbosePreference -ine 'SilentlyContinue' } | ForEach-Object { Invoke-CommonScript @_ } } Catch { } Finally { $UpdateModule | Remove-Module -Verbose:$False } } <# .SYNOPSIS Updates Microsoft Edge browser software. .DESCRIPTION The script installs or updates Microsoft Edge 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%\MSEdge. .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\MSEdge -ErrorAction SilentlyContinue PS > .\UpdateMSEdge.ps1 -InstallLocation C:\ProgramData\MSEdge -SaveTo . PS > Get-ChildItem C:\ProgramData\MSEdge | Select-Object Name -First 5 Name ---- BHO EBWebView edge_feedback Extensions identity_proxy Locales PS > Get-ChildItem | Select-Object Name Name ---- microsoft_edge_105.0.1343.27.exe UpdateMSEdge.ps1 Install MSEdge browser to 'C:\ProgramData\MSEdge' and save its setup installer to the current directory. #> |