As you should be aware, the next version of PowerShell is open source and cross-platform. You will be able to run PowerShell v6 on Windows, a Mac and select Linux distributions. All of the code is currently in alpha and hosted on the PowerShell GitHub repository. This is also where you can download new builds to install and test. I'll admit I'm a little behind the curve and part of that is because I don't often check if there is a new release. So I built a PowerShell module that will do that for me, and even download new installation packages. The best part, is that this should work cross-platform.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
My module, called PSReleaseTools, currently has 3 commands.
- Get-PSReleaseSummary
- Get-PSReleaseAsset
- Save-PSRelease
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 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:
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 Size seems to work just fine.
Now I have everything I need to keep on top of the latest builds of PowerShell v6. I also have reports that this works on non-Windows systems running the v6 alpha bits. You can find the module on GitHub at https://github.com/jdhitsolutions/PSReleaseTools. Try it out everywhere and let me know how it goes. Please use Issue tracking on GitHub.
Update: Well that didn't take long. The module is now on the PowerShell Gallery so you can install it from there.
Install-Module PSReleasetools
I made one significant change and that was to rename the save function to use the same noun as Get-PSReleaseAsset for the sake of consistency. I should have done that sooner. This is especially recommended when piping from one command to another. As I was working on the save command I started down one path then realized I could include another so the command changed a bit and I didn't bother to rename it. We should be good now. Let me know how it works out for you.
Nice, Jeff…
Think we’ll be using VS Code instead of ISE? 😉
On non-Windows machines I’m pretty sure that is the direction. VSCode is cross-platform and part of an editor services initiative at Microsoft. I don’t think the ISE is going away anytime soon on Windows but I wouldn’t expect it to get much in the way of updating.