Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failures in PowerShell 7.2 preview #9

Closed
jdhitsolutions opened this issue Dec 18, 2020 · 1 comment
Closed

Failures in PowerShell 7.2 preview #9

jdhitsolutions opened this issue Dec 18, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@jdhitsolutions
Copy link
Owner

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

@jdhitsolutions jdhitsolutions added the bug Something isn't working label Dec 18, 2020
@jdhitsolutions
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant