Playing with Latest PowerShell Core Version

In the previous tip we illustrated how you can download a PowerShell script which automatically downloads the latest version of PowerShell Core.

This script supports a number of parameters. By default, it fetches the latest (stable) production version. If you’d like to play with the latest version including preview versions, use the -Preview parameter. And, if you’d like to install it using an MSI package, add -MSI.

You don’t necessarily have to save the script to a file. Instead, you can directly execute the downloaded script file and invoke it with Invoke-Expression. This cmdlet is considered risky though because it directly executes any code you submit, without a chance for you to review the code first.

Here is a sample line that downloads the latest PowerShell Core version using MSI:

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

Twitter This Tip! ReTweet this Tip!

GD Star Rating
loading...