jdhitsolutions / WTToolbox

:computer: A set of PowerShell commands for managing and using the Windows Terminal application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failures in PowerShell 7.2 preview

jdhitsolutions opened this issue · comments

In the latest version of .NET core, there appears to be an incompatibility with the Appx commands. This module uses Get-AppxPackage so it might not work in PowerShell 7.2 or even PowerShell 7.1

This should be fixed for all PowerShell 7.x releases with this code:

 if ($PSVersionTable.PSVersion.ToString() -match "^7\.[1-9]") {
        Write-Verbose "[$((Get-Date).TimeofDay)] Detected PowerShell $($matches[0])"
        Invoke-Command -ScriptBlock { Get-AppxPackage $using:Name } -ConfigurationName Microsoft.PowerShell -ComputerName localhost
    }
    else {
         Get-AppxPackage -Name $name
    }

This was added in v1.11.1