PowerShell Core is the cross-platform version of PowerShell that runs on Windows, Mac and Linux. If you are not familar with it, check out my previous blog post on the topic. It's likely that PowerShell Core will see more regular releases than we've had historically with Windows PowerShell. While you will be able to download the .msi installer for these releases to update your version, this blog post covers how can use the Windows package management tool Chocolatey to manage your upgrades instead.
Since February 2017 its been possible on Linux to install and upgrade PowerShell via the package management tools
yum. Windows doesn't natively have a package management tool and Chocolatey exists to fill that void. Package managers greatly simplify the task of installing and managing software packages.
"Chocolatey is a package manager for Windows (like apt-get or yum but for Windows). It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer."
If you don't have chocolatey already, there are several installation options detailed here: https://chocolatey.org/install (which I suggest you check for the latest information). For example, you can open an administrative PowerShell prompt and simply run:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Once this has completed you can check chocolatey is installed by running
choco at the command-line, which should return something like this:
Now that you have Chocolatey, you can use it to install PowerShell Core.
Note: if you already have a version of PowerShell Core installed manually, you should uninstall it first.
You can see the PowerShell Core Chocolatey Package here. Per that page, to install PowerShell Core with Chocolatey run (from an administrative level cmd or powershell window):
choco install powershell-core
-y to have it auto accept/bypass any prompts).
This should complete as follows:
After which you should find PowerShell Core in your start menu:
If/when PowerShell Core becomes outdated, you can check if a newer version is available by running
and upgrade it by running (in an administrative console):
choco upgrade powershell-core
If you ever need to install a specific version of PowerShell Core, you can do so with the
--version switch. For example:
choco install powershell-core --version 6.0.0
Note that if you do this from within PowerShell Core the upgrade will complete but your console will close as a result.
This has been a quick intro to Chocolatey and how you can use it to manage packages. By using the above workflow you can manage and maintain your PowerShell Core version from the console, in the same way as you can on Linux.