Last active
August 15, 2024 18:07
-
-
Save milnak/76635aafcc3a7cd3db1cd0ad249cdf73 to your computer and use it in GitHub Desktop.
Download Latest PowerShell: PowerShell script to download latest PowerShell x64 MSI from github
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function DownloadLatestPS { | |
| Param([Parameter(Mandatory=$true)][string]$Folder) | |
| $json = curl -s 'https://api.github.com/repos/PowerShell/PowerShell/releases/latest' | ConvertFrom-Json | |
| $ps = $json.assets | Where-Object name -Like 'PowerShell-*-win-x64.msi' | |
| "Downloading: {0}" -f $ps.name | |
| $oldpp = $progresspreference | |
| $progresspreference = 'SilentlyContinue' | |
| Invoke-WebRequest $ps.browser_download_url -OutFile (Join-Path $Folder $ps.name) | |
| $progressPreference = $oldpp | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment