r/PowerShell • • Mar 04 '20

Announcing PowerShell 7.0 | PowerShell

https://devblogs.microsoft.com/powershell/announcing-powershell-7-0/?WT.mc_id=reddit-social-marouill
281 Upvotes

74 comments sorted by

View all comments

21

u/idontknowwhattouse33 Mar 04 '20
(Invoke-RestMethod https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json).ReleaseTag -replace '^v' -eq '7.0.0' ? 'Happy PowerSheller' : 'A sad day'

14

u/Yevrag35 Mar 04 '20

And download it like a boss:

$latest = Invoke-RestMethod 'https://api.github.com/repos/PowerShell/PowerShell/releases/latest'

$downloadUrl = $latest.assets | Where-Object Name -like "*win-x64.msi" | Select-Object -ExpandProperty 'browser_download_url'
$fileName = Split-Path $downloadUrl -Leaf

$webClient = New-Object System.Net.WebClient
try {
    $webClient.DownloadFile($downloadUrl, "$PSScriptRoot\$fileName")
}
finally {
    $webClient.Dispose()
}

5

u/halbaradkenafin Mar 05 '20

Choco install pwsh or choco upgrade pwsh is even easier