This PowerShell module provides a set of commands for working with the latest releases from the PowerShell GitHub repository. The module contains commands to get summary information about the most current release as well as commands to download some or all of the release files.
Initial testing has indicated that this module should work cross-platform. If you are running one of the alpha builds of PowerShell v6, even on Linux, you should be able to use this module to download new versions.
The module currently has 3 commands:
Note: I renamed the save command to use the same noun as
Get-PSReleaseAsset
for consistency after I took the screen shots.
All of the functions take advantage of the GitHub API which in combination with either Invoke-RestMethod or Invoke-WebRequest, allow you to programmatically interact with GitHub.
The first command, Get-PSReleaseSummary
queries the PowerShell repository release page and constructs a text summary.
I put the release name and date right at the top so you can quickly check if you need to download something new. In GitHub, each release file is referred to as an asset. The Get-PSReleaseAsset
command will query GitHub about each file and write a custom object to the pipeline.
By default it will display assets for all platforms, but I added a -Family
parameter if you want to limit yourself to a single entry like MacOS.
Of course, you will want to download these files which is the job of the last command. By default the command will save all files to the current directory unless you specify a different path. You can limit the selection to a specific platform via the -Name
parameter which uses a validation set.
You can select multiple names. If you select only Windows names then there is a dynamic parameter called -Format
where you can select ZIP or MSI. And the command supports -WhatIf
.
I also realized you might run Get-PSReleaseAsset
, perhaps to examine details before downloading. Since you have those objects, why not be able to pipe them to the save command? The command has Filename, Size and URL parameters which accept pipeline input by property name so that you can pipe like this to Save-PSReleaseAsset
:
By the way, I'm using the file size to test if the file downloaded completely. I know there are hashes in the release page but I didn't feel like trying to parse them out and I can't find them anywhere else. Using the file size seems to work just fine.
This module has been published to the PowerShell Gallery. You should be able to run these commands to find and install it.
Find-Module PSReleaseTools
Install-Module PSReleaseTools
I have a few other ideas for commands I might add to this module. If you have suggestions or encounter problems, please post an issue.
DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED THOROUGHLY IN A LAB ENVIRONMENT. USE AT YOUR OWN RISK. IF YOU DO NOT UNDERSTAND WHAT THIS CODE DOES OR HOW IT WORKS, DO NOT USE OUTSIDE OF A SECURE, TEST SETTING.
Last updated 5 January 2017