Giter Site home page Giter Site logo

psreleasetools's Introduction

PSReleaseTools

PSGallery Version PSGallery Downloads

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 PowerShell version as well as functions to download some or all of the release files or install the latest stable and/or preview build of PowerShell.

These commands utilize the GitHub API, which is subject to rate limits. It is recommended that you save results of commands like Get-PSReleaseAsset to a variable. If you encounter an error message for Invoke-RestMethod like "Server Error" then you have likely exceeded the API limit. You will need to wait a bit and try again. You do not need to have or use a GitHub account to use these commands.

This module should work cross-platform on both Windows PowerShell 5.1 and PowerShell 7.x, but is primarily intended for Windows platforms.

You can install this module from the PowerShell Gallery.

Install-Module PSReleaseTools

The Module

The module currently has 9 commands:

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.

Get Current Release

The first command, Get-PSReleaseCurrent can provide a quick summary view of the latest stable or preview release.

PS C:\> Get-PSReleaseCurrent

Name                                   OnlineVersion       Released                    LocalVersion
----                                   -------------       --------                    ------------
v7.1.0 Release of PowerShell           7.1.0               11/11/2020 4:23:08 PM              7.1.0

The command writes a custom object to the pipeline which has additional properties.

PS C:\> Get-PSReleaseCurrent -preview | Select-Object *

Name         : v7.2.0-preview.2 Release of PowerShell
Version      : v7.2.0-preview.2
Released     : 12/15/2020 9:31:39 PM
LocalVersion : 7.1.0
URL          : https://github.com/PowerShell/PowerShell/releases/tag/v7.2.0-preview.2
Draft        : False
Prerelease   : True

Summary Information

Get-PSReleaseSummary queries the PowerShell repository release page and constructs a text summary. You can also have the command write the report text as markdown.

get-psreleasesummary.png

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.

PS C:\> Get-PSReleaseAsset

FileName      : powershell-7.1.0-1.centos.8.x86_64.rpm
Family        : CentOS
Format        : rpm
SizeMB        : 65
Hash          : F3985B24719534F27A6C603416C7644771E17C75AFBFD8E6D5E98390045BF9D3
Created       : 11/10/2020 8:08:04 PM
Updated       : 11/10/2020 8:08:06 PM
URL           : https://github.com/PowerShell/PowerShell/releases/download/v7.1.0/powershell-7.1.0-1.centos.8.x86_64.rpm
DownloadCount : 10509
...

By default, the command will display assets for all platforms, but I added a -Family parameter if you want to limit yourself to a single entry like MacOS.

PS C:\> Get-PSReleaseAsset -Family MacOS

FileName      : powershell-7.1.0-osx-x64.pkg
Family        : MacOS
Format        : pkg
SizeMB        : 63
Hash          : 9B7397266711B279B5413F42ABC899730539C8D78A29FD116E19A1BB78244D78
Created       : 11/10/2020 8:08:18 PM
Updated       : 11/10/2020 8:08:20 PM
URL           : https://github.com/PowerShell/PowerShell/releases/download/v7.1.0/powershell-7.1.0-osx-x64.pkg
DownloadCount : 47202

FileName      : powershell-7.1.0-osx-x64.tar.gz
Family        : MacOS
Format        : gz
SizeMB        : 63
Hash          : 10CE8B2837F30F127F866E9680F518B9AA6288222C24B62AD1CAD868FB2A66E9
Created       : 11/10/2020 8:08:21 PM
Updated       : 11/10/2020 8:08:26 PM
URL           : https://github.com/PowerShell/PowerShell/releases/download/v7.1.0/powershell-7.1.0-osx-x64.tar.gz
DownloadCount : 3657
...

Of course, you will want to download these files, which is the job of the last command. By default, Get-PSReleaserAsset will save all files to the current directory unless you specify a different path. You can limit the selection to a specific platform with the -Family parameter, which uses a validation set.

PS C:\> Save-PSReleaseAsset -Family Ubuntu -Path D:\Temp -WhatIf
What if: Performing the operation "Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.1.0/powershell_7.1.0-1.ubuntu.16.04_amd64.deb" on target "D:\temp\powershell_7.1.0-1.ubuntu.16.04_amd64.deb".
What if: Performing the operation "Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.1.0/powershell_7.1.0-1.ubuntu.18.04_amd64.deb" on target "D:\temp\powershell_7.1.0-1.ubuntu.18.04_amd64.deb".
What if: Performing the operation "Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.1.0/powershell_7.1.0-1.ubuntu.20.04_amd64.deb" on target "D:\temp\powershell_7.1.0-1.ubuntu.20.04_amd64.deb".

You can select multiple names. If you choose Windows, there is a dynamic parameter called -Format where you can select ZIP or MSI. Save-PSReleaseAsset 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?

PS C:\> Get-PSReleaseAsset -Family Rhel  | Save-PSReleaseAsset -Path D:\Temp -Passthru


    Directory: D:\Temp


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         1/13/2021  11:13 AM       67752949 powershell-7.1.0-1.rhel.7.x86_64.rpm

The current version of this module uses regular expression named captures to pull out the file name and corresponding SHA256 hashes. The save command then calls Get-FileHash to get the current file hash and compares them.

Installing a Build

On Windows, it is pretty easy to install a new build with a one-line command:

Get-PSReleaseAsset -Family Windows -Only64Bit -Format msi |
Save-PSReleaseAsset -Path d:\temp -Passthru | Invoke-Item

Or you can use one of two newer functions to install the latest 64bit release. You can specify the interaction level.

Install-PSPreview will download the latest 64-bit preview build for Windows and kick off the installation.

Install-PSPreview -Mode Passive

Install-PowerShell will do the same thing but for the latest stable release. The command retains Install-PSCore as an alias.

Install-PowerShell -Mode Quiet -EnableRemoting -EnableContextMenu -EnableRunContext

The functionality of these commands could have been combined, but I decided to leave them as separate commands, so there is no confusion about what you are installing. In both cases, an installation log file will be created at $env:TEMP\PS7Install.log.

Non-Windows platforms have existing command-line installation tools that don't need to be replaced. Plus, I don't have the resources to develop and test installation techniques for all of the non-Windows options. That is why install-related commands in this module are limited to Windows.

Preview Builds

Beginning with v0.8.0 of this module, command functions have a -Preview parameter, which will get the latest preview build. Otherwise, the commands will use the latest stable release.

PowerShell Repository Issues

A new set of commands have been introduced in v1.8.0. These commands are intended to make it easier for you to look at issues from the PowerShell GitHub repository. The idea is that you can take a peek at open issues from your PowerShell session and then open the issue in your browser to learn more or contribute.

Get-PSIssue

Get-PSIssue is intended to get open PowerShell issues from Github. With no parameters, you can get the 25 most recent issues. Use the -Count parameter to increase that value using one of the possible values. The actual number of issues returned may vary depending on the rest of your command and how GitHub pages results.

You can also fine-tune your search to get issues that have been updated since a given date. Finally, you can also limit your search to issues tagged with a specific label.

Get-PSIssue

The function writes a custom object to the pipeline and includes a default formatted view. If you are running PowerShell 7, the issue body will be rendered as markdown.

Here is another way you might use the command.

Get-PSIssue Summary

Note: The PSIssue commands use the GitHub API and anonymous connections. The API has rate limits. If you run one of these commands excessively in a short period of time, you might see an error about exceeding the rate limit. If this happens, all you can do is wait an hour and try again. You can read more about GitHub rate-limiting here.

Get-PSIssueLabel

To make it easier to search for issues based on a label run Get-PSIssueLabel. This command will list available labels from the PowerShell repository. However, you most likely won't need to run this command often. When you import the PSReleaseTools module, it will create a global variable called $PSIssueLabel.

PS C:\> $PSIssueLabel

name                         description
----                         -----------
.NET                         Pull requests that update .net code
Area-Build
Area-Cmdlets
Area-Cmdlets-Archive
Area-Cmdlets-Core
Area-Cmdlets-Management
Area-Cmdlets-Utility
Area-Console
Area-DSC
...

This variable is used as part of an argument completer for the Labels parameter on Get-PSIssue.

Open-PSIssue

Finally, you may want to respond to an issue. If you run Open-PSIssue without any parameters, it should open the Issues section of the PowerShell repository in your browser. Or you can pipe an issue object to the command, as long as you include the Url property.

Get-PSIssue | Select-Object Updated,Labels,Title,Url | Out-GridView -PassThru | Open-PSIssue

There are no plans to add a command to open a new issue from a PowerShell session. You can use Open-PSIssue to get to GitHub and then use your browser to submit a new issue.

Support

If you have suggestions or encounter problems, please post an issue in this GitHub repository. If you find this project useful, or any of my work, please consider a small support donation.

❤️Sponsor

Last Updated 2021-10-15 15:21:21Z

psreleasetools's People

Contributors

gimly avatar jdhitsolutions avatar mavaddat avatar xtqqczze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psreleasetools's Issues

Not all preview files and hashes are detected

It looks like the regex to parse data isn't detecting all preview files and their hashes.

PS C:\scripts\PSReleaseTools> Get-PSReleaseAsset -Preview -Family Debian | select filename,hash


FileName                                            Hash
--------                                            ----
powershell-preview_7.0.0-rc.2-1.debian.10_amd64.deb
powershell-preview_7.0.0-rc.2-1.debian.11_amd64.deb
powershell-preview_7.0.0-rc.2-1.debian.9_amd64.deb

Wish List

Here are some things I'm thinking about adding when I get the chance.

  • Find a way to get the SHA 256 hashes for the downloads Done
  • Create a simple command to return the most recent version number and published date Get-PSReleaseCurrent
  • Maybe create an installation wrapper command
  • Create a command to list open issues

Update Family for win-fxdependent

There is a new family of win-fxdependent that needs to be accounted for. Right now that family property is blank.

FileName      : PowerShell-6.2.1-win-fxdependent.zip
Family        :
Format        : zip
SizeMB        : 27
Hash          : 541008A6F968AE13727428F939089F3B0430E47C2772272F58621874002ADB2B
Created       : 5/21/2019 5:10:31 PM
Updated       : 5/21/2019 5:10:35 PM
URL           : https://github.com/PowerShell/PowerShell/releases/download/v6.2.1/PowerShell-6.2.1-win-fxdependent.zip
DownloadCount : 153

Add format to Get-PSReleaseAsset

Get-PSReleaseAsset needs a parameter to allow specifying a format such as msi or zip. Maybe make it a dynamic parameter for Windows only.

Not Testable on OSX

This looks really exciting but currently not testable on OSX - the latest Alpha on OSX still tells me that PSGallery Is Currently Unavailable. UGH. Set-PSRepository isn't working correctly.

Updating Windows Terminal Reference?

Quick question: I installed the tools and did an install to upgrade from 7.1.3 to 7.1.4 (which worked perfectly). But I'm still getting the nag announcement every time I launch Windows Terminal (i.e., Terminal doesn't seem to recognize the update). Is there a way to fix that with the tools?

Get preview releases

Currently, this module defaults to getting stable releases. Need to add parameter options to get preview builds.

Exception calling "Add" on filename already recorded in dictionary @ public.ps1:264 char:18

PSVersion Table

Name Value
PSVersion 5.1.19555.1001
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19555.1001
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

PSCompatibleVersions:

Major Minor Build Revision
1 0 -1 -1
2 0 -1 -1
3 0 -1 -1
4 0 -1 -1
5 0 -1 -1
5 1 19555 1001

What is the syntax or expression you are using?

Install-PSPreview -mode Passive

What happens?

image

 Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
if(Get-InstalledModule -Name PSReleaseTools -ErrorAction Ignore) {Import-Module PSReleaseTools; Install-PSPreview -mode Passive} else {$false}
ForEach-Object : Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary:
'powershell-7.0.0-rc.2-linux-x64.tar.gz'  Key being added: 'powershell-7.0.0-rc.2-linux-x64.tar.gz'"
At C:\Program Files\WindowsPowerShell\Modules\PSReleaseTools\1.4.1\functions\public.ps1:264 char:18
+             $r | ForEach-Object -Begin {
+                  ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ForEach-Object], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException,Microsoft.PowerShell.Commands.ForEachObjectCommand

What do you think should happen?

public.ps1 should only try to add the filename to the dictionary object without assuming that it will be unique.

Dead link for `help Install-PowerShell -Online`

PSVersion Table

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

What is the syntax or expression you are using?

help Install-PowerShell -Online

What happens?

The url http://bit.ly/325i1Bm is opened and the redirected to https://github.com/jdhitsolutions/PSReleaseTools/blob/master/Docs/Install-PSCore.md , which does not exist. The default 404 error page of GitHub is shown.

What do you think should happen?

The redirect should point to https://github.com/jdhitsolutions/PSReleaseTools/blob/master/Docs/Install-PowerShell.md

`Install-PSPreview` module is parsing `-WhatIf` as a path ∴ generating error on `-WhatIf`

PSVersion Table

Name Value
PSVersion 5.1.19592.1001
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19592.1001
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

What is the syntax or expression you are using?

 Install-PSPreview -WhatIf

What happens?

What if: Performing the operation "Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.1.0-preview.1/PowerShell-7.1.0-preview.1-win-x64.msi" on target "C:\Users\MAVADD~1\AppData\Local\Temp\PowerShell-7.1.0-preview.1-win-x64.msi".
- InstallMsi : Cannot validate argument on parameter 'Path'. The "Test-Path $_" validation script for the argument with value "C:\Users\MAVADD~1\AppData\Local\Temp\whatif-preview.msi" did not return a result of True. Determine why the validation script failed, and then try the command again.
- At C:\Program Files\WindowsPowerShell\Modules\PSReleaseTools\1.6.0\functions\public.ps1:412 char:24
- +             InstallMSI @inParams
- +                        ~~~~~~~~~
-    + CategoryInfo          : InvalidData: (:) [InstallMsi], ParameterBindingValidationException
-    + FullyQualifiedErrorId : ParameterArgumentValidationError,InstallMsi

What do you think should happen?

The output should not error on -WhatIf specification. When using -WhatIf, the Install-PSPreview module seems to be testing the path concatenation of 'whatif' with 'preview' to get whatif-preview.msi, which is not correct. -WhatIf should not be treated as a path.

Rename Save command

Rename the Save-PSRelease command to use the same noun as the Get-PSReleaseAsset for consistency.

Invoke-Restmethod required TLS 1.2

PSVersion Table

PSVersion 5.1.16299.248
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.248
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

What is the syntax or expression you are using?

Get-PSReleaseSummary

What happens?

Invoke-Restmethod : The request was aborted: Could not create SSL/TLS secure channel.
At C:\Users\Jim\Documents\WindowsPowerShell\Modules\PSReleaseTools\0.6.0\PSReleaseTools.psm1:81 char:17

  •     $data = Invoke-Restmethod -uri $uri -Method Get
    
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

What do you think should happen?

After a quick google search I executed this in my PowerShell session:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
I then ran 'Get-PSReleaseSummary' again and it worked perfectly.

Cannot download the MSI

PSVersion Table

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.2
PSEdition                      Core
GitCommitId                    7.0.2
OS                             Microsoft Windows 10.0.20152
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS C:\>

What is the syntax or expression you are using?

Install-PSPreview -Mode Quiet -EnableRemoting -EnableContextMenu -Verbose`

What is happening?

PS C:\> Install-PSPreview -Mode Quiet -EnableRemoting -EnableContextMenu -Verbose
VERBOSE: [02:55:08.1852176 BEGIN  ] Starting Install-PSPreview
VERBOSE: [02:55:08.1874370 PROCESS] Saving download to C:\Users\Username\AppData\Local\Temp
VERBOSE: [02:55:08.1896271 BEGIN  ] Starting: Get-PSReleaseAsset
VERBOSE: [02:55:08.1923900 PROCESS] Getting preview assets
VERBOSE: [02:55:08.1962399 GetData] Getting current release information from https://api.github.com/repos/powershell/powershell/releases
VERBOSE: GET https://api.github.com/repos/powershell/powershell/releases with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: [02:55:09.1557066 GetData] Getting latest preview
VERBOSE: [02:55:09.1595284 PROCESS] Adding powershell-7.1.0-preview.4-linux-alpine-x64.tar.gz [997289C18609BA13E6EAC6E37DA31F6FD871FED624705FE1A892021D6D9EE1D0]
VERBOSE: [02:55:09.1614808 PROCESS] Adding powershell-7.1.0-preview.4-linux-arm32.tar.gz [23B24E2DEC8583D50DC8D48A380E15D5F4941A88A0258D2F5A98612C48D6B1F5]
VERBOSE: [02:55:09.1625786 PROCESS] Adding powershell-7.1.0-preview.4-linux-arm64.tar.gz [BF865A1CA368230B55B1483EB08D0D7CBBE59F258BC44C87B5736F9AFA374288]
VERBOSE: [02:55:09.1635923 PROCESS] Adding powershell-7.1.0-preview.4-linux-x64.tar.gz [10A8CE6F294EEEF262413F855C798AFA40F8D96ACA368AFF978E3D6A3A8923ED]
VERBOSE: [02:55:09.1645818 PROCESS] Adding powershell-7.1.0-preview.4-linux-x64-fxdependent.tar.gz [01FE879CBB98076976D0650629F3886CC8804B9B1C4D9E4AD802C2BE71D0C475]
VERBOSE: [02:55:09.1655972 PROCESS] Adding powershell-7.1.0-preview.4-osx-x64.pkg [ABF09C6F17E48EBAF88DF474E3E6136AEF35155EC324A88D65A2BE4BB5D2EF66]
VERBOSE: [02:55:09.1665928 PROCESS] Adding powershell-7.1.0-preview.4-osx-x64.tar.gz [80E80F4C3D3587511FCB2520818B2735659765B59999AEDE43CD80BC34E9C6AD]
VERBOSE: [02:55:09.1675700 PROCESS] Adding PowerShell-7.1.0-preview.4-win-arm32.zip [ACAE3B0E21B08D13203BD6BA8188AB0311D6AA3A8EA849EEF9F5C2D7EEBF8A5A]
VERBOSE: [02:55:09.1685611 PROCESS] Adding PowerShell-7.1.0-preview.4-win-arm64.zip [B8583BE44CE9989728D958916C5CC84B8EAA9A107597953A45AFF4A4E46F1B08]
VERBOSE: [02:55:09.1695224 PROCESS] Adding PowerShell-7.1.0-preview.4-win-fxdependent.zip [52AE59400C2CFC23AB8F6DBF9C8DFFD8EA158A6119FF9AB3C32C7FB410E97617]
VERBOSE: [02:55:09.1704819 PROCESS] Adding PowerShell-7.1.0-preview.4-win-fxdependentWinDesktop.zip [47783183A0A68ECB68253EF1E8D33DEC35D131D0D76E870FEE6AF7866DED4A2C]
VERBOSE: [02:55:09.1714356 PROCESS] Adding PowerShell-7.1.0-preview.4-win-x64.zip [57C3729E5772970167685B3324835289E5A4BBDE1C9D7DE358725F1168CC6D8D]
VERBOSE: [02:55:09.1725888 PROCESS] Adding PowerShell-7.1.0-preview.4-win-x86.zip [F21AD6DBDA5C7C533D81F6D400CE5555E17507B4982B7FA1DFBB1C4551C5CF23]
VERBOSE: [02:55:09.1772700 PROCESS] Adding powershell-preview_7.1.0-preview.4-1.debian.10_amd64.deb [FB0423937AF55C39284BD5F8BCD1A65322E4B2C6E8C7F3623427ABE62B04F0FB]
VERBOSE: [02:55:09.1798359 PROCESS] Adding powershell-preview_7.1.0-preview.4-1.debian.11_amd64.deb [7EDF436D22F9FC539419024040FD1C185AE7DD23B6D188D5CA7E75768798025A]
VERBOSE: [02:55:09.1816202 PROCESS] Adding powershell-preview_7.1.0-preview.4-1.debian.9_amd64.deb [658DBCD319EA58DFD90EDE93C4333168FEF8E6F09F7E6F6E14D982176D64CBF2]
VERBOSE: [02:55:09.1837836 PROCESS] Adding powershell-preview_7.1.0-preview.4-1.ubuntu.16.04_amd64.deb [D0BD977EB7FF3BBA3DACE96F79440D1AC30475C6E45ADDF0210FC3F9EF52D554]
VERBOSE: [02:55:09.1848452 PROCESS] Adding powershell-preview_7.1.0-preview.4-1.ubuntu.18.04_amd64.deb [5F53A695C6D60923EF7DDB20AEEBC68F67DDAD1ED8A9B4484502FA3AAD8397AA]
VERBOSE: [02:55:09.1857946 PROCESS] Adding powershell-preview-7.1.0_preview.4-1.centos.8.x86_64.rpm [AE252C9DBB7CF5816B5D90CB6CD601066B052A9A0F82150F0706A58F431EAE0B]
VERBOSE: [02:55:09.1867228 PROCESS] Adding powershell-preview-7.1.0_preview.4-1.rhel.7.x86_64.rpm [E8C29169A07B13A4FD07793F99E4CAFB6E1FC371A77C17A2B06B7B9C30856DB5]
VERBOSE: [02:55:09.1877563 PROCESS] Found 20 downloads
VERBOSE: [02:55:09.2744277 PROCESS] Filtering by family
VERBOSE: [02:55:09.2767907 PROCESS] Filtering for 64bit
VERBOSE: [02:55:09.2794333 PROCESS] Filtering for format
WARNING: Get-PSReleaseAsset Failed to find any release assets using the specified critiera.
VERBOSE: [02:55:09.2815896 END    ] Ending: Get-PSReleaseAsset
WARNING: No preview MSI file found to download and install.
VERBOSE: [02:55:09.2836614 END    ] Ending Install-PSPreview
PS C:\>

What is the issue?

There is not currently an MSI available for download due to this issue:
PowerShell/PowerShell#13035

Looks like they almost have a solution in this pull:
PowerShell/PowerShell#13036

What I think should happen.

  • It would be nice if PSReleaseTools could grab the zip if there is an issue with the MSI, either automatically, or get confirmation from the user first.
  • Another idea that would be helpful is to give an error saying something like "Hey, looks like there is a newer release than you have installed, but we cannot currently locate the MSI."

Bug: If no MSI is available (only zip) Install-PSPreview fails

PSVersion Table

PSVersion 5.1.19041.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

What is the syntax or expression you are using?

Install-PSPreview -mode passive

What happens?

Error:
InstallMsi : Cannot validate argument on parameter 'Path'. Cannot bind argument to parameter 'Path' because it is an em
pty string.
C:\Program Files\WindowsPowerShell\Modules\PSReleaseTools\1.6.1\functions\public.ps1:414 char:28

What do you think should happen?

I tracked down the problem to the line : Get-PSReleaseAsset -Preview -Family Windows -Only64Bit -Format msi
At the time of testing I tried to install PS 7.1.0 preview 4, though it seems there are no msi available on the site.
Therefore this strange error is thrown.

Update help and docs

Need to update help and documentation to make reference to PowerShell 7 in place of PowerShell Core.

Update installation options

The MSI install for 7.2 includes new options that should be supported in Install-PowerShell

The PowerShell 7.2 MSI package includes following command-line options:

  • USE_MU - This property has two possible values:
    • 1 (default) - Opts into updating through Microsoft Update or WSUS
    • 0 - Do not opt into updating through Microsoft Update or WSUS
  • ENABLE_MU
    • 1 (default) - Opts into using Microsoft Update the Automatic Updates or Windows Update
    • 0 - Do not opt into using Microsoft Update the Automatic Updates or Windows Update

Install-PowerShell error when using -WhatIf

Need to adjust code when using -WhatIf.

PS C:\> Install-PowerShell -EnableRemoting -EnableContextMenu -Mode Quiet -WhatIf
What if: Performing the operation "Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.0.1/PowerShell-7.0.1-win-x64.msi" on target "C:\Users\Jeff\AppData\Local\Temp\PowerShell-7.0.1-win-x64.msi".
InstallMsi: C:\Program Files\WindowsPowerShell\Modules\PSReleaseTools\1.6.0\functions\public.ps1:467
Line |
 467 |              InstallMSI @inParams
     |                         ~~~~~~~~~
     | Cannot validate argument on parameter 'Path'. The "Test-Path $_" validation script for the argument with value
     | "C:\Users\Jeff\AppData\Local\Temp\whatif-preview.msi" did not return a result of True. Determine why the
     | validation script failed, and then try the command again.

PS C:\>

Install-PSPreview not installing PS 7.3

PSVersion Table

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

What is the syntax or expression you are using?

Install-PSPreview -Verbose

What happens?

Fails with error:
InstallMsi : Cannot process argument transformation on parameter 'Path'. Cannot convert value to type System.String.

The issue seems to be that, because PS 7.3 includes an .msix asset, this command now returns two objects:
Get-PSReleaseAsset -Preview -Family Windows -Only64Bit -Format msi

I think this is most relevant line:
$assets = $assets.where( {$_.format -match $($format -join "|")})

Full output of Install-PSPreview -Verbose:

VERBOSE: [12:30:35.9335482 BEGIN  ] Starting Install-PSPreview
VERBOSE: [12:30:35.9481363 PROCESS] Saving download to c:\temp
VERBOSE: [12:30:35.9954501 BEGIN  ] Starting: Get-PSReleaseAsset
VERBOSE: [12:30:35.9986451 BEGIN  ] Starting: Save-PSReleaseAsset
VERBOSE: [12:30:36.0085730 GetData] Getting current release information from https://api.github.com/repos/powershell/powershell/releases                                                                                                        VERBOSE: GET https://api.github.com/repos/powershell/powershell/releases with 0-byte payload                            VERBOSE: received 1027306-byte response of content type application/json                                                VERBOSE: Content encoding: utf-8
VERBOSE: [12:30:37.2184835 GetData] Getting latest preview
VERBOSE: [12:30:37.2829548 PROCESS] Found 22 downloads
VERBOSE: [12:30:37.3338079 PROCESS] Filtering by family
VERBOSE: [12:30:37.3492446 PROCESS] Filtering for 64bit
VERBOSE: [12:30:37.3565020 PROCESS] Filtering for format
VERBOSE: [12:30:37.3599782 PROCESS] Using Parameter set file
VERBOSE: [12:30:37.3614274 PROCESS] ...PowerShell-7.0.0-preview.3-win-x64.msi [69C4435C24D80447B6A1A8C1C8F4BC91F5D8E2B25616FD45C121CBE3CCD97B87]
VERBOSE: [12:30:37.3765202 DL] https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.3/PowerShell-7.0.0-preview.3-win-x64.msi to c:\temp\PowerShell-7.0.0-preview.3-win-x64.msi
VERBOSE: GET https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.3/PowerShell-7.0.0-preview.3-win-x64.msi with 0-byte payload
VERBOSE: received 92053504-byte response of content type application/octet-stream
VERBOSE: [12:30:42.1818536 DL] Comparing file hash to 69C4435C24D80447B6A1A8C1C8F4BC91F5D8E2B25616FD45C121CBE3CCD97B87
VERBOSE: [12:30:42.6790953 PROCESS] Using Parameter set file
VERBOSE: [12:30:42.6814546 PROCESS] ...PowerShell-7.0.0-preview.3-win-x64.msix [A972F2A3CF4256E8CBC2AB3EB0481647D9C2721E61D4CA26E20EB1E62422835B]
VERBOSE: [12:30:42.6833259 DL] https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.3/PowerShell-7.0.0-preview.3-win-x64.msix to c:\temp\PowerShell-7.0.0-preview.3-win-x64.msix
VERBOSE: GET https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.3/PowerShell-7.0.0-preview.3-win-x64.msix with 0-byte payload
VERBOSE: received 96034094-byte response of content type application/octet-stream
VERBOSE: [12:30:47.6447665 DL] Comparing file hash to A972F2A3CF4256E8CBC2AB3EB0481647D9C2721E61D4CA26E20EB1E62422835B
VERBOSE: [12:30:48.1588564 END    ] Ending: Get-PSReleaseAsset
VERBOSE: [12:30:48.1601423 END    ] Ending: Save-PSReleaseAsset
InstallMsi : Cannot process argument transformation on parameter 'Path'. Cannot convert value to type System.String.
At C:\Git\PSReleaseTools\functions\public.ps1:367 char:30
+             InstallMSI -path $filename -mode $mode
+                              ~~~~~~~~~
+ CategoryInfo          : InvalidData: (:) [InstallMsi], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,InstallMsi

VERBOSE: [12:30:48.2155926 END    ] Ending Install-PSPreview

Install Non preview versions

Hi @jdhitsolutions

Does this module supoprts the installation of non preview versions of PowerShell?
If not, it could be an interesting feature to have (like, with a silent installer etc..).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.