Failures in PowerShell 7.2 preview
jdhitsolutions opened this issue · comments
Jeff Hicks commented
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
Jeff Hicks commented
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