UpdatePostman.ps1
<#PSScriptInfo .VERSION 0.0.2 .GUID 2f1b305e-e034-4c55-ac95-b296474098b7 .AUTHOR Fabrice Sanga .COMPANYNAME sangafabrice .COPYRIGHT © 2022 SangaFabrice. All rights reserved. .TAGS postman nuget-package update http-client .LICENSEURI https://github.com/sangafabrice/reg-cli/blob/main/LICENSE.md .PROJECTURI https://github.com/sangafabrice/reg-cli/tree/postman .ICONURI https://rawcdn.githack.com/sangafabrice/reg-cli/4035da19b9d87f32003ddc6bad3d16d8f50796aa/icon.png .EXTERNALMODULEDEPENDENCIES DownloadInfo,RegCli .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES Change version string type to [version]. .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}\Postman", [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallerLocation $_ })] [string] $SaveTo = $PSScriptRoot ) & { $NameLocation = "$InstallLocation\postman.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 Postman } Catch { } ) NameLocation = $NameLocation SaveTo = $SaveTo SoftwareName = 'Postman' InstallerType = 'Squirrel' Verbose = $VerbosePreference -ine 'SilentlyContinue' } | ForEach-Object { Invoke-CommonScript @_ } } Catch { } Finally { $UpdateModule | Remove-Module -Verbose:$False } } <# .SYNOPSIS Updates Postman software. .DESCRIPTION The script installs or updates Postman 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%\Postman. .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\Postman -ErrorAction SilentlyContinue PS > .\UpdatePostman.ps1 -InstallLocation C:\ProgramData\Postman -SaveTo . PS > Get-ChildItem C:\ProgramData\Postman | Select-Object Name -First 5 Name ---- locales resources swiftshader chrome_100_percent.pak chrome_200_percent.pak PS > Get-ChildItem | Select-Object Name Name ---- postman_10.0.1.exe UpdatePostman.ps1 Install Postman to 'C:\ProgramData\Postman' and save its setup installer to the current directory. #> |