Skip to content

Repository files navigation

PSCoreUpdate

build

New cross-platform PowerShell update tool.

Motivation

PSCoreUpdate supports automation update of new cross-platform PowerShell (pwsh).

Currently, PowerShell Team is planning on supporting security updates of PowerShell through Microsoft Update on Windows (#6118), but it will take some time for realization.
Homebrew Cask is now available on macOS, but the installation of Homebrew is a bit heavy.

PowerShell Team began supporting updates to PowerShell via Microsoft Update starting with PowerShell 7.2, but updates cannot be performed at any time, and there is no module that can manage release assets.

This module is a little tool to solve such inconvenience.

How to install

You can install it from PowerShell gallery.

# Using PowerShellGetInstall-Module PSCoreUpdate
# Using Microsoft.PowerShell.PSResourceGetInstall-PSResource-Name PSCoreUpdate

Upgrade from version 2

If you use PSCoreUpdate version 2 or earlier, please uninstall all version first.

Uninstall-Module PSCoreUpdate -AllVersions
Install-Module PSCoreUpdate

Note : PSCoreUpdate version.3 has many breaking changes.

First-time installation

This module is for updating PowerShell.
So, the first-time installation must be performed manually.

You can use the official installation script.

Invoke-Expression"& { $(Invoke-RestMethod'https://aka.ms/install-powershell.ps1') } -UseMSI -Quiet"

Usage

Test-LatestVersion

Check if the current console is the latest version.

PS C:\>Test-LatestVersion
No updates. PowerShell 7.4.3 is the latest version.

If you use preview release PowerShell, you can use -Release Preview parameter.

PS C:\>Test-LatestVersion-Release Preview

if you use LTS version PowerShell, you can can use -Release LTS parameter.

PS C:\>Test-LatestVersion-Release LTS

Update-PowerShellRelease

Update PowerShell if the newer version found.

PS C:\>Update-PowerShellRelease-Latest

Update-PowerShellRelease.gif

If you want to update preview release, you can use -Release Preview parameter.

PS C:\>Update-PowerShellRelease-Latest -Release Preview

if you use LTS version PowerShell, you can can use -Release LTS parameter.

PS C:\>Update-PowerShellRelease-Latest -Release LTS

You can do silent install with -Silent switch parameter.

PS C:\>Update-PowerShellRelease-Latest -Silent
  • This cmdlet supports only Windows and macOS.
    You can use a package management tool like yum, apt etc. on Linux.

Find-PowerShellRelease

Find PowerShell release information from GitHub.

Note

This function uses GitHub REST API Version 2022-11-28.

PS C:\>Find-PowerShellRelease-MaxItems 10
Version Name Published PreRelease
------------------------------7.4.3 v7.4.3 Release of PowerShell 2024/06/1823:13:56 False
7.4.2 v7.4.2 Release of PowerShell 2024/04/1123:07:12 False
7.4.1 v7.4.1 Release of PowerShell 2024/01/1123:08:30 False
7.4.0 v7.4.0 Release of PowerShell 2023/11/1617:06:48 False
7.3.12 v7.3.12 Release of PowerShell 2024/04/1122:57:39 False
7.3.11 v7.3.11 Release of PowerShell 2024/01/1122:01:05 False
7.3.10 v7.3.10 Release of PowerShell 2023/11/1617:05:59 False
7.3.9 v7.3.9 Release of PowerShell 2023/10/2617:57:23 False
7.3.8 v7.3.8 Release of PowerShell 2023/10/1017:15:04 False
7.3.7 v7.3.7 Release of PowerShell 2023/09/1916:28:10 False

New features from version.3

Find-PowerShellRelease stores local in-memory cache for 10 minutes.
If you don't want use cache, use -NoCache parameter.

Find-PowerShellRelease-MaxItems 10-NoCache

-VersionRange parameter is added instead of -MinimumVersion, -MaximumVersion.
This parameter follows Nuget version range syntax.

PS C:\>Find-PowerShellRelease-VersionRange "[7.3,7.4]"
Version Name Published PreRelease
------------------------------7.4.0 v7.4.0 Release of PowerShell 2023/11/1617:06:48 False
7.3.12 v7.3.12 Release of PowerShell 2024/04/1122:57:39 False
7.3.11 v7.3.11 Release of PowerShell 2024/01/1122:01:05 False
7.3.10 v7.3.10 Release of PowerShell 2023/11/1617:05:59 False
7.3.9 v7.3.9 Release of PowerShell 2023/10/2617:57:23 False
7.3.8 v7.3.8 Release of PowerShell 2023/10/1017:15:04 False
7.3.7 v7.3.7 Release of PowerShell 2023/09/1916:28:10 False
7.3.6 v7.3.6 Release of PowerShell 2023/07/1322:39:48 False
7.3.5 v7.3.5 Release of PowerShell 2023/06/2723:21:50 False
7.3.4 v7.3.4 Release of PowerShell 2023/04/1318:37:36 False
7.3.3 v7.3.3 Release of PowerShell 2023/02/241:22:55 False
7.3.2 v7.3.2 Release of PowerShell 2023/01/2419:34:31 False
7.3.1 v7.3.1 Release of PowerShell 2022/12/1316:17:08 False
7.3.0 v7.3.0 Release of PowerShell 2022/11/090:37:40 False

Find-PowerShellBuildStatus

Find PowerShell build status.

PS C:\>Find-PowerShellBuildStatus-All
Version Release ReleaseDate
-------------------------7.4.3 Stable 2024/06/1823:26:067.5.0-preview.3 Preview 2024/05/2818:13:567.4.3 LTS 2024/06/1823:26:06

Find-PowerShellSupportStatus

Find PowerShell support status.

Note

This function uses endoflife.date raw data on GitHub.

# Find all versions
PS C:\>Find-PowerShellSupportStatus
Version Is EOS EOS Date
----------------------7.4 False 2026/11/107.3 True 2024/05/087.2 False 2024/11/087.1 True 2022/05/087.0 True 2022/12/036.2 True 2020/09/046.1 True 2019/09/286.0 True 2019/02/13# Find supported version only
PS C:\>Find-PowerShellSupportStatus-ExcludeEOS
Version Is EOS EOS Date
---------------------7.4 False 2026/11/107.2 False 2024/11/08

Save-PowerShellAsset

Download PowerShell release assets.

PS C:\>Save-PowerShellAsset-Latest -AssetType MSI_WIN64 -OutDirectory .\

The types of assets are as follows.

ValueAsset
HASHES_SHA256hashes.sha256
MSI_WIN32[PowerShell version]-win-x86.msi
MSI_WIN64[PowerShell version]-win-x64.msi
MSI_ARM64[PowerShell version]-win-arm64.msi
MSIXBUNDLE[PowerShell version]-win.msixbundle
PKG_OSX[PowerShell version]-osx-x64.pkg
PKG_OSXARM64[PowerShell version]-osx-arm64.pkg
RPM_CM[PowerShell version]-cm.x86_64.rpm
RPM_CMARM64[PowerShell version]-cm.aarch64.rpm
RPM_RH[PowerShell version]-rh.x86_64.rpm
DEB_DEB64[PowerShell version]-deb_amd64.deb
TAR_LINUXARM32[PowerShell version]-linux-arm32.tar.gz
TAR_LINUXARM64[PowerShell version]-linux-arm64.tar.gz
TAR_LINUXALPINE64[PowerShell version]-linux-(musl|alpine)-x64.tar.gz
TAR_LINUX64FXDEPENDENT[PowerShell version]-linux-x64-fxdependent.tar.gz
TAR_LINUXALPINE64FXDEPENDENT[PowerShell version]-x64-(musl-noopt|alpine)-fxdependent.tar.gz
TAR_LINUX64[PowerShell version]-linux-x64.tar.gz
TAR_OSX[PowerShell version]-osx-x64.tar.gz
TAR_OSXARM64[PowerShell version]-osx-arm64.tar.gz
ZIP_WINARM64[PowerShell version]-win-arm64.zip
ZIP_WIN32[PowerShell version]-win-x86.zip
ZIP_WIN64[PowerShell version]-win-x64.zip
ZIP_WINFXDEPENDENT[PowerShell version]-win-fxdependent.zip
ZIP_WINFXDEPENDENTDESKTOP[PowerShell version]-win-fxdependentWinDesktop.zip

Old release assets

  • These assets are not available from the latest version.
ValueAsset
MSIX_WIN32[PowerShell version]-win-x86.msix (Currently unreleased #13284)
MSIX_WIN64[PowerShell version]-win-x64.msix (Currently unreleased #13284)
MSIX_WINARM32[PowerShell version]-win-arm32.msix (Currently unreleased #13284)
MSIX_WINARM64[PowerShell version]-win-arm64.msix (Currently unreleased #13284)
PKG_OSX1011[PowerShell version]-osx.10.11-x64.pkg
PKG_OSX1012[PowerShell version]-osx.10.12-x64.pkg
RPM_RHEL8[PowerShell version]-centos.8.x86_64.rpm
RPM_RHEL7[PowerShell version]-rhel.7.x86_64.rpm
DEB_DEBIAN8[PowerShell version]-debian.8_amd64.deb
DEB_DEBIAN9[PowerShell version]-debian.9_amd64.deb
DEB_DEBIAN10[PowerShell version]-debian.10_amd64.deb
DEB_DEBIAN11[PowerShell version]-debian.11_amd64.deb
DEB_UBUNTU14[PowerShell version]-ubuntu.14.nn_amd64.deb
DEB_UBUNTU16[PowerShell version]-ubuntu.16.nn_amd64.deb
DEB_UBUNTU17[PowerShell version]-ubuntu.17.nn_amd64.deb
DEB_UBUNTU18[PowerShell version]-ubuntu.18.nn_amd64.deb
DEB_UBUNTU20[PowerShell version]-ubuntu.20.nn_amd64.deb
APPIMAGE[PowerShell version]-x86_64.AppImage
WIXPDB32[PowerShell version]-win-x86.wixpdb
WIXPDB64[PowerShell version]-win-x64.wixpdb
ZIP_WINARM32[PowerShell version]-win-arm32.zip (Removed in PowerShell 7.4 Preview.5 #20102)

About

New cross-platform PowerShell update tool.

Topics

Resources

Stars

18 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages