Skip to content

AppX package installation locations cannot be targeted with Get-Item / Get-ChildItem #11013

Closed

Description

This is a regression from Windows PowerShell.

On Windows, AppX packages (for in-box applications such as Calculator) are installed in subfolders of hidden folder $env:ProgramFiles\WindowsApps

PowerShell Core cannot locate these folders, not even with -Force (which shouldn't be necessary, because it is only the parent folder that is hidden).

Curiously, you can target files inside those folders, though only by literal name.

The problem may be related to permissions.

Steps to reproduce

Run the following on Windows:

$pkgDir = (Get-AppxPackage Microsoft.WindowsCalculator).InstallLocation

# OK, because a file *inside* the dir. is targeted by literal name.
{ Get-Item -EA Stop -Force $pkgDir\Calculator.exe } | Should -Not -Throw

# Targeting the dir. directly fails:
{ Get-Item -EA Stop -Force -LiteralPath $pkgDir } | Should -Not -Throw
{ Get-ChildItem -EA Stop -Force -LiteralPath $pkgDir } | Should -Not -Throw

# Using a wildcard produces no output.
# (This problem, unlike the others, also occurs in Windows PowerShell).
Get-ChildItem -Force -Path $pkgDir*  | Should -Not -BeNullOrEmpty

Expected behavior

All tests should pass.

Actual behavior

All tests but the first fail, because the directory itself cannot be targeted:

"Cannot find path 'C:\Program Files\WindowsApps\Microsoft.WindowsCalculator_10.1908.0.0_x64__8wekyb3d8bbwe' because it does not exist."

The wildcard-based command produces no output.

Environment data

PowerShell Core 7.0.0-preview.5

Activity

  1. added
    Issue-Question
    on Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-QuestionResolution-Fixed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions